Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Attributes to RadiobuttonList???

Status
Not open for further replies.

jen89

Programmer
Aug 16, 2001
105
US
I have a radio button list

Code:
<asp:RadioButtonList id=&quot;rblSearchType&quot; runat=&quot;server&quot; CssClass=&quot;DROPDOWNLIST&quot; AutoPostBack=&quot;True&quot;>
				<asp:ListItem Value=&quot;PAPPLICATION&quot; Selected=&quot;True&quot;>Patent Application</asp:ListItem>
				<asp:ListItem Value=&quot;PFAMILY&quot;>Patent Family</asp:ListItem>
			</asp:RadioButtonList>

When I change the selection on this list, I need to confirm that the user really wants to do this, since it will wipe out some of their information. So I added the following code in my page load:

Code:
if not ispostback() then
rblSearchType.Attributes.Add(&quot;onSelectedIndexChanged&quot;, &quot;javascript:return confirm('Are you sure you want to change your search type?  All Search Criteria and Output Criteria will be cleared.');&quot;)
end if

This works great, kind of. If the user hits the actual radio button, the popup works as expected. If they hit the label, then select &quot;OK&quot;, the popup comes up a second time. Please, if anyone has any ideas, I'd really appreciate it! Thanks,
 
Oops, the attribute event, onSelectedIndexChanged, should have been onClick. I posted an experiment
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top