0

こんにちは、1 つの TextBox を使用して、さまざまな種類の chossings を照会します。たとえば、最初の RadioButton (姓) を選択すると、クライアントの姓で検索し、2 番目の RadioButton (Doc. Code) を選択すると、コードで検索します。 、たとえば、ユーザーが「日付で検索」を選択して文字列タイプを送信した場合、例外を管理または処理するにはどうすればよいですか?

C#3.5を使用しています-Asp.net

正規表現で作成し、それを RadioButton イベントに追加したいので、ユーザーがラジオを変更するときに、オプション A にいくつかの文字を入力し、オプション B にその他の文字を入力し、オプション C に日付だけを入力できます ... (正規表現)

よろしくお願いします

4

1 に答える 1

1

if you are using the asp web control radiobuttonlist then you can make lots of changes when their is a postback. you can set the attribute to SelectIndexChanged,so whenever their is a change it cause a postback and then you can do whatever from their(verifications). ex:

   <asp:radioButtonList
     id="radio1" runat="server" 
     autoPostBack="true"
     cellSpacing="20"
     repeatColumns="3"
     repeatDirection="horizontal"
     RepeatLayout="table"
     textAlign="right"
     OnSelectedIndexChanged="radio_SelectedIndexChanged">
     <asp:ListItem text="10pt" value="itsMe"/>  
     <asp:ListItem text="14pt" value="itsYou"/>  
     <asp:ListItem text="16pt" value="Neither"/>  
  </asp:radioButtonList>

on the server you should have

protected void radio_SelectedIndexChanged(object sender, EventArgs e)
{
 //do whatever you want by calling the name of the radio id
 //example

  if(radio1.SelectedItem.Value=="(whatever you want to test)"

}
于 2009-01-26T21:30:20.233 に答える