Home » Category » DotNet

DotNet: HtmlInputHidden Control

204| Sun, 01 Jun 2008 15:51:00 GMT| juliusfenata| 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 & Tags: htmlinputhidden, control, dotnet, .net

URL: http://dotnet.itags.org/dotnet-tech/313841/
 
«« Prev - Next »» 0 helpful answers below.

DotNet Hot Answers

DotNet New questions

DotNet Related Categories