2009-01-26 105 views
0

嗨有即時通訊使用單個文本框查詢不同類型的chossings,例如當我選擇第一個RadioButton(姓)我搜索客戶姓時,當我選擇第二個RadioButton(文檔代碼)我按代碼搜索等,請問我如何管理或處理異常,例如,如果用戶選擇「按日期搜索」併發送字符串類型?關於RadioButton CheckedChanged事件

進出口使用C#3.5 - Asp.net

我想用正則表達式,使其與添加在單選按鈕的事件,因此,當用戶改變無線電,他可以輸入optionA只是一些字符,其他更多在選項B中,只是2012年新OptionC中...(正則表達式)

感謝進步

+0

? – Element 2009-01-26 19:53:37

回答

1

,如果您使用的是asp網絡控制單選按鈕列表,那麼你可以做很多的變化時,他們是回發。您可以將該屬性設置爲SelectIndexChanged,因此無論何時它們發生更改時都會導致回發,然後您可以執行任何操作(驗證)。 例如:

<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> 

在服務器上,你應該有

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)" 

} 
用什麼語言