asp.net - AutoPost capture what caused it. -


i have following code in .aspx file:

    <asp:textbox id="txtsearch" runat="server" width="278px"></asp:textbox>     <asp:button id="btnsearch" runat="server" text="search" autopostback="true" /> 

when click on btnsearch button autopostback.

what goal if btnsearch clicked, capture value of txtsearch or else not

how code such if btnsearch clicked on autopost can flag it.

first, button does not have autopostback property. posts always.

second, can handle it's click event , read txtsearch.text property:

<asp:textbox id="txtsearch" runat="server" width="278px"></asp:textbox> <asp:button id="btnsearch" runat="server" text="search" onclick="btnsearch_click" /> 

codebehind:

protected void btnsearch_click(object sender, eventargs e) {     string search = txtsearch.text;     // ... } 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -