婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > ASP.NET2.0使用Enter Key作為默認(rèn)提交問題分析(附源碼)

ASP.NET2.0使用Enter Key作為默認(rèn)提交問題分析(附源碼)

熱門標(biāo)簽:400電話辦理哪家性價比高 地圖標(biāo)注專業(yè)團(tuán)隊 遂寧市地圖標(biāo)注app 天心智能電銷機(jī)器人 地圖定位圖標(biāo)標(biāo)注 塔城代理外呼系統(tǒng) 代理接電話機(jī)器人如何取消 濮陽外呼電銷系統(tǒng)怎么樣 地圖標(biāo)注的公司有哪些

本文實(shí)例分析了ASP.NET2.0使用Enter Key作為默認(rèn)提交的方法。分享給大家供大家參考,具體如下:

網(wǎng)頁開發(fā)中最煩人的事情之一就是為表單處理"Enter key" ,"Enter key"已經(jīng)成為用戶提交表單的偏好。雖然我們?yōu)橛脩籼峁┝颂峤话粹o,但是最簡單也是最直接的方式仍然是:輸入文字,然后回車完成提交

ASP.NET 2.0中為此提供了很好的解決方法。只需要將"defaultbutton"屬性指定到想要引發(fā)事件的按鈕控件的ID上就可以了。

在表單級別和面板級別(asp:panel> 標(biāo)記)均可以指定"defaultbutton"。當(dāng)表單和面板中同時指定了defaultbutton,則如果在面板中觸發(fā)了"Enter key",則執(zhí)行面板中的

下面的實(shí)例代碼中有一個表單和4個面板,報單和面板中都有按鈕。情各位注意:在文本框中回車后會觸發(fā)哪些按鈕的事件

form id="form1" runat="server" defaultbutton="btn1">
div>
asp:TextBox ID="txt" runat="server">/asp:TextBox>
asp:Button ID="Button5" runat="server" Text="Cancel" OnClick="Button5_Click" />
asp:Button ID="btn1" runat="server" Text="Submit" OnClick="btn1_Click" />
asp:Panel ID="pnl1" runat="server" defaultbutton="Button1">
asp:TextBox ID="TextBox1" runat="server">/asp:TextBox>
asp:TextBox ID="TextBox2" runat="server">/asp:TextBox>
asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" />
/asp:Panel>
asp:Panel ID="Panel1" runat="server" defaultbutton="Button2">
asp:TextBox ID="TextBox3" runat="server">/asp:TextBox>
asp:TextBox ID="TextBox4" runat="server">/asp:TextBox>
asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" />
/asp:Panel>
asp:Panel ID="Panel2" runat="server" defaultbutton="Button3">
asp:TextBox ID="TextBox5" runat="server">/asp:TextBox>
asp:TextBox ID="TextBox6" runat="server">/asp:TextBox>
asp:Button ID="Button3" runat="server" Text="Button3" OnClick="Button3_Click" />
/asp:Panel>
asp:Panel ID="Panel3" runat="server" defaultbutton="Button4">
asp:TextBox ID="TextBox7" runat="server">/asp:TextBox>
asp:TextBox ID="TextBox8" runat="server">/asp:TextBox>
asp:Button ID="Button4" runat="server" Text="Button4" OnClick="Button4_Click" />
/asp:Panel>
/div>
/form>
//The corresponding, sample events for the button clicks are
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(Button1.Text);
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Write(Button2.Text);
}
protected void Button3_Click(object sender, EventArgs e)
{
Response.Write(Button3.Text);
}
protected void Button4_Click(object sender, EventArgs e)
{
Response.Write(Button4.Text);
}
protected void btn1_Click(object sender, EventArgs e)
{
Response.Write(btn1.Text);
}
protected void Button5_Click(object sender, EventArgs e)
{
Response.Write(Button5.Text);
}

完整實(shí)例代碼代碼點(diǎn)擊此處本站下載。

希望本文所述對大家asp.net程序設(shè)計有所幫助。

您可能感興趣的文章:
  • ASP.NET基于Ajax的Enter鍵提交問題分析
  • asp.net textbox javascript實(shí)現(xiàn)enter與ctrl+enter互換 文本框發(fā)送消息與換行(類似于QQ)
  • asp.net(c#)Enterprise Library 3.0 下載
  • ASP.Net 請求響應(yīng)流程簡述
  • asp.net實(shí)現(xiàn)取消頁面表單內(nèi)文本輸入框Enter響應(yīng)的方法

標(biāo)簽:吉林 麗江 汕頭 宜春 河南 本溪 婁底 重慶

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《ASP.NET2.0使用Enter Key作為默認(rèn)提交問題分析(附源碼)》,本文關(guān)鍵詞  ASP.NET2.0,使用,Enter,Key,作為,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《ASP.NET2.0使用Enter Key作為默認(rèn)提交問題分析(附源碼)》相關(guān)的同類信息!
  • 本頁收集關(guān)于ASP.NET2.0使用Enter Key作為默認(rèn)提交問題分析(附源碼)的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 铁力市| 怀宁县| 罗田县| 马山县| 长垣县| 枣阳市| 尚志市| 九江县| 灌南县| 竹山县| 沭阳县| 宜兰县| 榆社县| 夹江县| 娱乐| 迁安市| 牟定县| 措美县| 阿城市| 镇江市| 休宁县| 扬州市| 汾西县| 望江县| 富裕县| 曲靖市| 永德县| 永福县| 新巴尔虎左旗| 白沙| 班戈县| 汝阳县| 太仆寺旗| 荥经县| 靖州| 永吉县| 伊春市| 全南县| 大渡口区| 正安县| 偃师市|