开发者

Call HTML control in code behind

How can I get gridview HTML textbox value in .aspx.cs code?? E.g. :

<input id="Frequency" name="customerName" type="text" style="width: 44px" />

If i use the bellow code ,Then i can get the value on selectedIndex event.

string n = Str开发者_JAVA技巧ing.Format("{0}", Request.QueryString['customerName']);

I want to use bellow syntax.

TextBox_Label1 = (TextBox)e.Row.FindControl("Frequency");

i don't want to user the runat="server" on HTML control .

From Gridview i need to call a popup,Popup return a value ,I use the bellow code on javascript to do that

 window.opener.document.getElementById("customerName").value = val;              
                window.close();

In my gridview .if i put the runat="server" then return value not set ,So i need to remove the runat="server".It also not work if i put the Asp:TextBox on Grid.Help me to Return popup value on gridview Asp:TextBox

Thanks!


Try a databinding expression:

<input id="Frequency" name="customerName" type="text" style="width: 44px"><%# String.Format("{0}", Request.QueryString["customerName"])%></input>


If you're having problems with this process and the difference is one is runat="server" and the other is not, I would suggest you need to look at your JavaScript to make sure that you have the proper element selection method. The rendered ClientID will be different from a standard html control ID. If you write your code so that the ClientID is injected into the JavaScript, you can keep the runat="server" and achieve your results. Standard html controls are not accessible from the code behind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜