Change text of link button based on selected value of dropDownList

  • Thread starter Thread starter Andy B
  • Start date Start date
A

Andy B

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?
 
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
 
Cant you use ajax for something like this?


Eliyahu Goldin said:
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 said:
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?
 
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 said:
Cant you use ajax for something like this?


Eliyahu Goldin said:
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 said:
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?
 
Back
Top