Im bit confusing while using HIDDENFILED Controller in asp.net.why we use HIDDENFILED Controller in Gridview.
Why we use HIDDENFILED Controller in asp.net
Hi,
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 28, 2013, 11:48 PM EDT
The HiddenField control is used to store a value. It is rendered element. View state, session state and cookies are used to maintain the state of a web forms page. You can use HiddenField instead of view state, session state and cookies.
Regards,
Iftikar
KRayudu V157 reputationPosted Aug 29, 2013, 12:00 AM EDT
and we will access this Controler using findcontrol in code behind.whats the use?
Anurag SarkarRank #1,049 · 1.8K reputationPosted Aug 29, 2013, 12:01 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 29, 2013, 12:01 AM EDT
Hiddenfield control used to store value . and it will not shown to user in design but you can use it in that page in client side. you can use hiddenfield instead of viewstate. the hiddenfield value is only available for that page where it placed not in all the pages.
KRayudu V157 reputationPosted Aug 29, 2013, 1:09 AM EDT
GridViewdefined as follows:ID="myGridView" AutoGenerateColumns="false" runat="server" OnLoad="myGridView_Load" OnRowCommand="myGridView_Command" OnRowEditing="myGridView_RowEditing" OnRowDeleting="myGridView_RowDeleting" DataKeyNames="ID" > DataField="ID" Visible="false" /> DataField="BirthDate" Visible="false" /> DataField="FirstName" HeaderText="First Name" /> DataField="LastName" HeaderText="Last Name" /> HeaderText="Other"> ID="editLB" runat="server" Text="edit" CommandName="Edit" /> ID="deleteLB" runat="server" Text="delete" CommandName="Delete" /> When a user clicks the edit button, I need to get the value of the BirthDate column. To attempt this, I have tried the following: protected void myGridView_RowEditing(object sender, GridViewEditEventArgs e) { GridViewRow row = gvUsers.Rows[e.NewEditIndex]; DateTime birthDate = (DateTime)(row.Cells[1].Text); // Does not work } I know it has something to do with the fact that the column is not visible. The column must be hidden. But I need to get that value— how can I do this?Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 29, 2013, 1:12 AM EDT
share your aspx and cs code. we will check that.