i have many radio buttons:
<asp:RadioButtonList ID="selectedYesNoQuestionBlock1" runat="server" RepeatDirection="Horizontal"
OnSelectedIndexChanged="Question1GotAnswered" AutoPostBack="true">
<asp:ListItem Text="Yes" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="selectedYesNoQuestionBlock2" runat="server" RepeatDirection="Horizontal"
A开发者_开发知识库utoPostBack="true" OnSelectedIndexChanged="Question2GotAnswered">
<asp:ListItem Text="Yes" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:RadioButtonList>
etc.
for each radio button i have their method:
protected void Question1GotAnswered(object sender, EventArgs e)
{}
i want to react on this in Page_Load before method Question1GotAnswered() will be called. i'am trying it but everything is unsuccessuful.
tried something like this:
protected void Page_Load(object sender, EventArgs e)
{
if (sender.ToString() == "Question1GotAnswered")
{}
}
please help i need it much!
The only way to do it is to check the if (Request.Form["__EVENTTARGET"] == control.ClientID) { }
to see that the control posting back is the given control that caused the postback. So this should be the ID of your radio button causing the postback.
HTH.
精彩评论