DotNet: HtmlInputHidden Control

  • juliusfenata / 204 / Thurs, 18 Jun 2009 11:46:00 GMT / Comments (0)
  • Okay,

    I have pass new value from client to server, like this:

    <script language="JavaScript">
    function JSGenerateArticleID()
    {
    HiddenValue.value = "test";
    }
    </script>
    ...
    <input id="HiddenValue" type="hidden" runat="server">

    Then, I need to use this value on Code Behind, like this:

    protected System.Web.UI.HtmlControls.HtmlInputHidden HiddenValue;
    ...
    private void btnAdd_Click(object sender, System.EventArgs e)
    {
    clsArticle m_oArticle = new clsArticle();
    m_oArticle.InsertArticle(HiddenValue.Value); // Not Working
    BindingDataGrid();
    }

    Why after I have web-controls HiddenValue the Value is still null? Or,
    Server-side did not recognize HiddenValue?

    ps: What is relation between this control with AutoEventWireUp="true"?

    Thx,
    Julius F

    =================================================

    Hi Julius,

    You have to pass the new value from client to server separately, the Label
    element won't do it for you. There is a number of ways for doing this, most
    common one is via a hidden <input> element.

    Eliyahu

  • Keywords:

    htmlinputhidden, control, dotnet, .net

  • http://dotnet.itags.org/dotnet-tech/313841/«« Last Thread - Next Thread »»