Sunday, 22 July 2012

How to get the value hidden control of user control in .aspx page

 

In .ascx file(UserControl1)

<script type="text/javascript">
    $(function () {
        $('.address-radio').change(
            function () {
                $('#<%=AddressHidden.ClientID %>').val($(this).val())
                            }
        )
    })
</script>

<asp:HiddenField ID="AddressHidden" runat="server" />

In aspx page

HiddenField hidden = (HiddenField)UserControl1.FindControl("HiddenField1");
        if (hidden != null)
        {
            string value = hidden.Value.ToString();
        }

http://forums.asp.net/t/1369427.aspx

No comments:

Post a Comment