CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: NewsGroup Date Entered: 2/12/2008 9:25:57 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 52 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
1 Items, 1 Pages 1 |< << Go >> >|
zipperjones
Asp.Net User
Changing Image Button Source within a User Control2/12/2008 9:25:57 PM

0/0

Hi!

 I am trying to create a navigation user control using image buttons, and I have "on" and "off" versions of each button.

I would like to write code to dynamically switch out the Image URL of the clicked image button, turning the clicked button "on" and turning all the other selected buttons "off".  Another reason I want to accomplish this dynamically is so that I can call this method from external pages when the user control loads.

My code and HTML is included below.  Any help would be greatly appreciated!

<table style="text-align:center;width:100%"><tr style="vertical-align:middle"><td>

<asp:ImageButton ID="draft" runat="server" ImageUrl="~/images/vcnav_draft_off.png" />

</td><td>

<asp:ImageButton ID="review" runat="server" ImageUrl="~/images/vcnav_review_off.png" />

</td><td>

<asp:ImageButton ID="print" runat="server" ImageUrl="~/images/vcnav_print_off.png" />

</td><td>

<asp:ImageButton ID="sign" runat="server" ImageUrl="~/images/vcnav_sign_off.png" />

</td><td>

<asp:ImageButton ID="send" runat="server" ImageUrl="~/images/vcnav_send_off.png" />

</td></tr></table>

Protected Sub draft_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles draft.Click

SetActiveButton("draft")

Response.Redirect("vcwname.aspx")

End Sub

Public Sub SetActiveButton(ByVal sButtonID As String)

For Each c As Control In Me.Page.Controls

If TypeOf c Is ImageButton Then

Dim im As ImageButton = DirectCast(c.FindControl(c.ID), ImageButton)

If im.ID = sButtonID Then

im.ImageUrl = "~/images/vcnav_" & sButtonID & "_on.png"

Else

im.ImageUrl = "~/images/vcnav_" & sButtonID & "_off.png"

End If

c = im

End If

Next c

End Sub

 

1 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
C#Builder Kick Start: Kick Start Authors: Joe Mayo, Pages: 480, Published: 2004
Macromedia Dreamweaver MX Unleashed Authors: Matthew Pizzi, Zak Ruvalcaba, Pages: 1002, Published: 2002
A Balanced Introduction to Computer Science Authors: David Reed, Pages: 408, Published: 2007
ASP.NET 2.0 Instant Results Authors: Imar Spaanjaars, Paul Wilton, Shawn Livermore, Pages: 456, Published: 2006
The Complete Guide to the NeXTSTEP User Environment: For Intel Processors a. NeXT Computers Authors: Michael B. Shebanek, Pages: 439, Published: 1993
ASP.NET Cookbook Authors: Michael A. Kittel, Michael A. Kittel Geoffrey T. LeBlond, Geoffrey T. LeBlond, Pages: 824, Published: 2004
Macromedia Dreamweaver MX: Training from the Source Authors: Khristine Annwn Page, Pages: 549, Published: 2003
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Professional C# 2005 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones, Pages: 1540, Published: 2006
Beginning ASP.NET 2.0 Databases: From Novice to Professional Authors: Damien Foggon, Pages: 625, Published: 2006

Web:
Silverlight ImageButton UserControl - Stack Overflow My xaml for the user control is as follows:




Search This Site:










how to...... install

web parts, ajax, asp.net 3.5 and drag and drop

ripped off, cannot create partial class on stongly type dataset in vsw express!

helloworld tutorial part 2 - c#

how do i access variable defined in sub page_load

locked out of login page

error the moment i open file in visual web development 2005 express edition

i'm in trouble...

custom calendar control

symmetric key encryption and decryption using rijndael algorithm ??

dnn 2.3 beta installation

timespan - no way to format ?

zip libary

passing variables to new aspx page using hyperlink column from a datagrid

search for a new "search results" module...

whos online?

system.net.sockets.socketexception

dnn 4.02 dataprovider type initialization problem

treeview single node only

should i stay or should i go?

isapproved in web.config, how??

references to dataset break after converiting from web site to web application project

partially trusted callers exception from asp.net.

dnn as an email listserv

liquid platinum weblog module v1.1 released

refresh button resends information

converting string to an integer

continually redirected back to http://localhost/dotnetnuke/default.aspx

employee info starter kit: combining asp.net 2.0 best pratices

tab control runs on localhost, but not on server

 
All Times Are GMT