我有四個單獨的部分,我希望在頁面中處理表單提交(當用戶代理處於移動時,顯示部分#1和#2):如何在asp.net中處理不同的表單提交webform
單元#1(移動:
<div id="mSearchB" class="mSearchTextHolder">
<div class="mSearchInnerTextHolder">
<input type="search" placeholder="Search" class="txtMSearch" id="txtMSearch" />
</div>
</div>
圖片#1:
節#2(移動):
<div class="brClear loginHolder floatLeft">
<input type="text" placeholder="Username" id="txtUsername" class="txtUsername styledTB floatLeft" />
</div>
<div class="floatLeft">
<input type="password" placeholder="Password" id="pwPassword" class="txtPassword styledTB floatLeft" />
</div>
<div class="floatLeft">
<a href="JavaScript:void(0);" title="Login" class="styledBtn logBtn floatLeft lightLinks">Login</a>
</div>
(圖像#2還沒有被建立但類似於#1)
節#3(非移動):
<div class="searchBox">
<input type="text" value="" placeholder="Search" id="searchB" />
<a href="JavaScript:void(0);" title="Search"><img src="theImages/searchWhite.png" alt="Search" title="Search" class="searchImg" /></a>
</div>
節#4(非移動):
<div class="brClear loginHolder">
<input type="text" placeholder="Username" id="txtUsername" class="txtUsername styledTB floatLeft" />
<input type="password" placeholder="Password" id="pwPassword" class="txtPassword styledTB floatLeft" />
<a href="JavaScript:void(0);" title="Login" class="styledBtn logBtn floatLeft lightLinks">Login</a>
</div>
圖片爲#3和#4:
對於#3和#4,如果我單擊搜索圖標,則所有三個文本框都佔位符空白。
我還沒有放置任何form
標籤圍繞上述任何一個,因爲asp.net頁面已經有一個自動插入創建頁面。
如何單獨處理每個提交,因此單擊或按一個文本框中的輸入不會提交整個表單?
這是WebForms? (聽起來就像這樣,根據你如何描述'form'標籤)。如果是這樣,那麼你不要把它們分開。在服務器端代碼中,對於不同的按鈕,您將擁有不同的點擊處理程序,但這只是一種形式導致一個回發。 – David 2014-10-07 13:04:32
是的,它是一個網頁表單。 – SearchForKnowledge 2014-10-07 13:05:13
那麼,讓每個按鈕都是一個服務器端控件,然後分別使用每個點擊?那麼在單獨的文本框上輸入「什麼」? – SearchForKnowledge 2014-10-07 13:06:00