473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Change text of link button based on selected value of dropDownList

I have a dropDownList and a LinkButton. The LinkButton's text needs to
reflect the selected item in the dropDownList. So, when Subscribe is
selected in the dropDownList, the LinkButton's text needs to also be
"Subscribe". Also, if the dropDownList's selected item is Unsubscribe, the
LinkButton's text needs to be "Unsubscribe". This needs to happen without a
page postback or reload. How do I do this?

Sep 8 '08 #1
3 1635
You can do it client-side in javascript. You will need to view the source
for the page, locate the controls in interest in html, and figure out what
client events to handle. It may be trivial or not so depending on where on
the page the controls are.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>I have a dropDownList and a LinkButton. The LinkButton's text needs to
reflect the selected item in the dropDownList. So, when Subscribe is
selected in the dropDownList, the LinkButton's text needs to also be
"Subscribe". Also, if the dropDownList's selected item is Unsubscribe, the
LinkButton's text needs to be "Unsubscribe". This needs to happen without a
page postback or reload. How do I do this?

Sep 8 '08 #2
Cant you use ajax for something like this?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ut*************@TK2MSFTNGP06.phx.gbl...
You can do it client-side in javascript. You will need to view the source
for the page, locate the controls in interest in html, and figure out what
client events to handle. It may be trivial or not so depending on where on
the page the controls are.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>>I have a dropDownList and a LinkButton. The LinkButton's text needs to
reflect the selected item in the dropDownList. So, when Subscribe is
selected in the dropDownList, the LinkButton's text needs to also be
"Subscribe". Also, if the dropDownList's selected item is Unsubscribe, the
LinkButton's text needs to be "Unsubscribe". This needs to happen without
a page postback or reload. How do I do this?


Sep 8 '08 #3
Sure, it will be much simpler. Put the controls in the same UpdatePanel and
handle server-side SelectedIndexChanged event.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uK**************@TK2MSFTNGP04.phx.gbl...
Cant you use ajax for something like this?
"Eliyahu Goldin" <RE**************************@mMvVpPsS.orgwrote in
message news:ut*************@TK2MSFTNGP06.phx.gbl...
>You can do it client-side in javascript. You will need to view the source
for the page, locate the controls in interest in html, and figure out
what client events to handle. It may be trivial or not so depending on
where on the page the controls are.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Andy B" <a_*****@sbcglobal.netwrote in message
news:uI**************@TK2MSFTNGP03.phx.gbl...
>>>I have a dropDownList and a LinkButton. The LinkButton's text needs to
reflect the selected item in the dropDownList. So, when Subscribe is
selected in the dropDownList, the LinkButton's text needs to also be
"Subscribe". Also, if the dropDownList's selected item is Unsubscribe,
the LinkButton's text needs to be "Unsubscribe". This needs to happen
without a page postback or reload. How do I do this?


Sep 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Do | last post by:
Hi, In my listbox, I'd like to change the color of some listitems depending on user security. I tried wrapping the <font color=red></font> around my listitme's .text property, but the tags...
1
by: TJS | last post by:
can someone tell me why the selected item won't reflect user change in this little droplist example <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(ByVal sender As Object,...
1
by: Airshow | last post by:
Hi, I have very simple Page_Load code in some code-behind class in ASP.NET (v. 1.1): private void Page_Load(object sender, System.EventArgs e) { if ( IsPostBack )...
2
by: Billy | last post by:
Change DataGrid EditControl On Data Value Hi, I have a datagrid, and on editing, I want to change the control in the third colunm based on the value of the first column. The value in the...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
2
by: Radu | last post by:
Hi, I have a "select" control named "cboSelectScorecardType", defined as <select id="cboSelectScorecardType" size="1" runat="server"> </select> which shows a list of files on my drive. It...
11
by: harold.gimenez | last post by:
Hi group, I am trying to change the selection of an ASP Dropdownlist just like "Orange" is selected here: http://www.w3schools.com/js/tryit.asp?filename=try_dom_option_selected The...
3
by: santhosh89 | last post by:
hi guys, see i want to develop a script and developed one but it s not working. the concept is there will be three radio buttons. the user has to check one radio button and click the button next...
1
by: angelicdevil | last post by:
i have listbox 1 which displays status , based on selection of status listbox 2 displays usernames. and based on username selected the textbox displays the email id. its working fine till...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.