I am trying to detect a postback from Radiobutton list.
I am trying to use following code:
If Page.Request.Params.Get("__EVENTTARGET") = optDownload.UniqueID.ToString Then
But Page.Request.Params.Get("__EVENTTARGET") returns
“ctl00$ContentPlaceHolder1$pnlBarAccounts$i0$i2$i0$CHChecking$Acct1$optDownload$4”
And optDownload.UniqueID.ToString returns
“ctl00$ContentPlaceHolder1$pnlBarAccounts$i0$i2$i0$CHChecking$Acct1$optDownload”
There is a difference in last 2 characters, how do I detect a postback from Radiobutton list?
The $4, I’m assuming, relates to the index of the selection radio options.
Just use the string contains function, i.e.
Anyway, that’s very bad. You should be listening for the event on the
RadioButtonList. Hook into theSelectedIndexChangeevent.That’ll work, but it sounds like you’re fixing the wrong problem for whatever reason you need to know if the list caused a postback.