开发者

Change Hidden Input With onFocus Between UserControls

This is probably embarrassingly easy, but I've having problems getting this to work.

On ResidentAddress.aspx, I have 2 user controls (AppName.ascx and NavButtons.ascx). When a textbox in AppName.ascx has focus, I want to update a hidden input field on NavButtons.ascx with the value of "TRUE". In the codebehind page for NavButtons, I want to see what the value of this hidden input filed is.

This is what I have so far:

Na开发者_如何学JAVAvButtons.ascx

<input type="hidden" id="IpChangeFlag" name="ChangeFlag" runat="server" value="FALSE" />

AppName.ascx

<asp:TextBox ID="txtFirstName" runat="server"  onFocus="document.getElementsByName('ChangeFlag').value='TRUE';">

NavButtons.ascx.vb

If IpChangeMade.Value.Trim.ToUpper = "TRUE" Then
    MyValue = true
End If

I am unable to change the value of ipChangeFlad. It always has the value of FALSE.


getElementsByName returns an array, access the first element. document.getElementsByName('ChangeFlag')[0].value='TRUE'

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜