What is the difference between view state and a hidden field?
As we know that view state allows the the state of objects to be stored in hidden fields and is stored in client side. but what is the exact difffrence between a view state and a hidden field
<div>A hidden field does not render visibly in the browser, but you can set its properties just as you can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP Form collection
along with the values of other controls. A hidden field acts as a repository for any page-specific information that you would like to store directly in the page. Hidden field stores a single variable in its
value property and must be explicitly added it to the page.
ASP.NET provides the HtmlInputHidden control that offers hidden field functionality.
[c#]
protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
//to assign a value to Hidden field
Hidden1.Value=”this is a test”;
//to retrieve a value
string str=Hidden1.Value;
Note: Keep in mind, in order to use hidden field, you have to use HTTP-Post method to post web page. Although its name is ‘Hidden’, its value is not hidden, you can see its value through ‘view source’ function.
</div>
B. View State
<div>
Each control on a Web Forms page, including the page itself, has a
ViewState property, it is a built-in struture for automatic retention of page and control state, which means you don’t need to do anything about getting back the data of controls after posting page to the server.
Here, which is useful to us is the ViewState property, we can use it to save information between round trips to the server.
[c#]
//to save information
ViewState.Add(“shape”,”circle”);
//to retrieve information
string shapes=ViewState[“shape”];
Note: Unlike Hidden Field, the values in ViewState are invisible when ‘view source’, they are compressed and encoded.</div> <div> </div> <div>Source :
http://www.csharphelp.com/archives/archive207.html</div> <div> </div> <div>Hope it helped you. Good luck!</div>
Please Don't forget to click "Mark as Answer" on the post that helped you.
This can be beneficial to other community members reading the thread.
The viewstate is managed by asp.net and is a compressed block of text that stores information for the controls on the page between page refreshes (postbacks).
It stores its data in a hidden field which is a html tag.
If you want to use hidden fields then you can add an asp:HiddenField control and use it.
If you want to store your own data in the ViewState object you can store it like ViewState["AgeOfCat"] = 6;
You are always using view state without realising it because gridview stores its data and the other controls.
You can disable viewstate on a per control, per page, or per site basis.
Some controls really need viewstate to function so they use a backup "viewstate" call controlstate which is accessed in the same way just incase you have viewstate turned off. Its important not to abuse controlstate.
The hidden field does not show, but still, when the form is submitted the hidden field is sent with it.Therefore the visitor can't type anything into a hidden field but we can assign values. getting values in post back or on page load.
View state:
To store values between postbacks in ASP.NET we go for viewstate ie
When a postback happens (i.e. when a form is submitted to a server), the variable values that are set in the code-behind page are erased from the memory of the client system. This concept would be different from what happens in Windows-based applications,
where the variables persist in memory until they are freed from the memory either by the garbage collector, or by specific codes like dispose or finalize.
In web applications, variable values simply get erased. But it is very simple to persist these values. They may be persisted using the Viewstate object. Before the postback is invoked, the variable's value is saved in a viewstate object. In the same page, the
viewstate's value may be retrieved back after hitting the server and returns back.
"Never underestimate the power of stupid people in large groups"
To The OP, just be aware ANYONE and their mother can change the hidden field on client side. However, they can't change view state. View State is 99.9% safe, hidden field is 0% safe.
I doubt that the asp hidden fields are visible and values can be modified, for example this page contains a hidden field named hiddenfieldgross, which I could not find in the client source, i.e from the browser source, so how can you say that ... I really
want to know ..
thanks
arunendra
Here is the code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
suvo
Member
2 Points
255 Posts
What is the difference between view state and a hidden field
Sep 02, 2008 02:12 PM|LINK
What is the difference between view state and a hidden field?
As we know that view state allows the the state of objects to be stored in hidden fields and is stored in client side. but what is the exact difffrence between a view state and a hidden field
cv_vikram
Star
8510 Points
1056 Posts
Re: What is the difference between view state and a hidden field
Sep 02, 2008 02:51 PM|LINK
A. Hidden Field
<div>A hidden field does not render visibly in the browser, but you can set its properties just as you can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP Form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you would like to store directly in the page. Hidden field stores a single variable in its value property and must be explicitly added it to the page.ASP.NET provides the HtmlInputHidden control that offers hidden field functionality.
[c#]
protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
//to assign a value to Hidden field
Hidden1.Value=”this is a test”;
//to retrieve a value
string str=Hidden1.Value;
Note: Keep in mind, in order to use hidden field, you have to use HTTP-Post method to post web page. Although its name is ‘Hidden’, its value is not hidden, you can see its value through ‘view source’ function.
</div>
B. View State
<div>Each control on a Web Forms page, including the page itself, has a ViewState property, it is a built-in struture for automatic retention of page and control state, which means you don’t need to do anything about getting back the data of controls after posting page to the server.
Here, which is useful to us is the ViewState property, we can use it to save information between round trips to the server.
[c#]
//to save information
ViewState.Add(“shape”,”circle”);
//to retrieve information
string shapes=ViewState[“shape”];
Note: Unlike Hidden Field, the values in ViewState are invisible when ‘view source’, they are compressed and encoded.</div> <div> </div> <div>Source : http://www.csharphelp.com/archives/archive207.html</div> <div> </div> <div>Hope it helped you. Good luck!</div>
This can be beneficial to other community members reading the thread.
rtpHarry
All-Star
56620 Points
8958 Posts
Re: What is the difference between view state and a hidden field
Sep 02, 2008 02:56 PM|LINK
The viewstate is managed by asp.net and is a compressed block of text that stores information for the controls on the page between page refreshes (postbacks).
It stores its data in a hidden field which is a html tag.
If you want to use hidden fields then you can add an asp:HiddenField control and use it.
If you want to store your own data in the ViewState object you can store it like ViewState["AgeOfCat"] = 6;
You are always using view state without realising it because gridview stores its data and the other controls.
You can disable viewstate on a per control, per page, or per site basis.
Some controls really need viewstate to function so they use a backup "viewstate" call controlstate which is accessed in the same way just incase you have viewstate turned off. Its important not to abuse controlstate.
deesh1531982
Contributor
4766 Points
823 Posts
Re: What is the difference between view state and a hidden field
Sep 02, 2008 03:08 PM|LINK
hidden field :
The hidden field does not show, but still, when the form is submitted the hidden field is sent with it.Therefore the visitor can't type anything into a hidden field but we can assign values. getting values in post back or on page load.
View state:
To store values between postbacks in ASP.NET we go for viewstate ie
When a postback happens (i.e. when a form is submitted to a server), the variable values that are set in the code-behind page are erased from the memory of the client system. This concept would be different from what happens in Windows-based applications, where the variables persist in memory until they are freed from the memory either by the garbage collector, or by specific codes like dispose or finalize.
In web applications, variable values simply get erased. But it is very simple to persist these values. They may be persisted using the Viewstate object. Before the postback is invoked, the variable's value is saved in a viewstate object. In the same page, the viewstate's value may be retrieved back after hitting the server and returns back.
ZachE84
Member
27 Points
16 Posts
Re: What is the difference between view state and a hidden field
Sep 16, 2008 09:35 PM|LINK
Great explanations.
To The OP, just be aware ANYONE and their mother can change the hidden field on client side. However, they can't change view state. View State is 99.9% safe, hidden field is 0% safe.
arunendra
Member
4 Points
2 Posts
Re: What is the difference between view state and a hidden field
Oct 19, 2010 09:34 PM|LINK
Hi
I doubt that the asp hidden fields are visible and values can be modified, for example this page contains a hidden field named hiddenfieldgross, which I could not find in the client source, i.e from the browser source, so how can you say that ... I really want to know ..
thanks
arunendra
Here is the code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
</title><link type="text/css" href="../Css/StyleSheetEntry.css" rel="stylesheet" /></head>
<body>
<form name="form1" method="post" action="NewPartyAdd.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="b63WJk5IxCoQ+u8YHmfootETCwP7IWJIV8Rnwubio44uKLeU1nGzMAtJJ/THx7M78zD0sySV7TRUidYjiR/QjCxVmCCyH5k/ONgXNn8fg3gJhioK3s1yYVStL3Mn4k/VaJmQ7UU19S8vbwnvtdXLWGaqQ+nDMGKZaSNMrx4el6dPMO4/MXNaxCvT+K3k8rFu0vlvbk/ta1zx6iqWL8xJ1roKmoSU4ngh9G/fF+mVwMRZcYZefLt5iY6f4ICXvhLdDQeZagnZv5o66JFYUFcsd0bDv0nxlb3/Fxc7c5bte+40WM6+k+CnypnpeJZ1BTHs1raSWWfDBDSfmSpVaUB30ZVjwS6JrNVGldXYpEOlah4KSX6J+2GcCW0omGli6FiSLMwCwbT6QZIIGYsqFmDbXPGZz3dT6FY6j3VrsyR1n2JhJ/Q34s9PYBw0JMqCMEwJG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re2yKQv0iO7NLlCezmoJ033vTiQHKXr0frXw+fLMEiWM6hpe/clbGDw9WXZipFf4B0/RbsMWWZO1O/GQ0CgCqMi9gEn/DpxWPvYifkAUou6V8cBsUPpMUljIa86T38jrQUBMmCkAKM3irng87f/kdah1niBrp9VFRegZZ5+5z0I/kMc8+tve+5pRF/7mQyrRqEZIFBr4UoILDUbolgSP0/OWv9dhRR021GpbQOkmcPKM2R0NsjPySjD9uFSrqShCyrXFIiIZmOpi5fUOxVeyvUz1SpxK7UMLXHLnzMgxkWskuJMSjFQH9cNVe2nhwlvzx34uXriTm50Tm3rxWX31T229II7HhzQu4qbVzBrizTfGI4jOZsq5wLB735gjEdGwt1hLZwEaWn02tRUhNArks5T0Xf7a0rqZkvpbmhwtn0Qo+B4khAHBBD8ZfEACNjYv542+ASklWu1mbxoyrnrbQpesMQC3wyzqN2RkxwOyYSM/WGchvkA+eYAjq0WRXGGIgTXrr9dr5kJWvbl9xXGUZAXiEbDRyQZmqdVUr93tjF+UQxImcqazW7zYh5c9vNTnS3syZZimHdgTa/YYc60f1FG+Sv+1PkJIgnicNQk62D4aV/fqCApFM2Mic2MLBiNhcNSN9Pz29PWQ8=" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/JetExpress/WebResource.axd?d=HLCTmfzYC4I55ztYhKe-Fg2&t=634129902512031250" type="text/javascript"></script>
<script src="/JetExpress/ScriptResource.axd?d=Gz3P343e8cXQf0SqIS2KOMw9cNE4lNxbT2C_8GnpXxi2lv_1nhfZTUXAaTIRhx7F_NNl6L_RPXv_1v4Sp5mKyQ2&t=634129902512031250" type="text/javascript"></script>
<script src="/JetExpress/ScriptResource.axd?d=ebs0qVKMuRCioh2EOWVPPZkfyurBCyqwPGWrVm1evzK8nbxctI0x-m6qGHEteTqDEGTW6_TCwAuKzpofrzOrHZQPPY1iv_sOsz9MoUIr1Jg1&t=633936674059687500" type="text/javascript"></script>
<script src="/JetExpress/ScriptResource.axd?d=ebs0qVKMuRCioh2EOWVPPZkfyurBCyqwPGWrVm1evzK8nbxctI0x-m6qGHEteTqDEGTW6_TCwAuKzpofrzOrHeTPiCVQjDUHUYzfq7SdV7uoOQW_cjxnfQTumz2M7MXc0&t=633936674059687500" type="text/javascript"></script>
<script src="/JetExpress/ScriptResource.axd?d=IVG8uIra7OTJCAD3A4tGElW9l5BuyxY9FcfYMzb1MZwdjj0XpRvDG1b31aG9U8ZZlPYwqewOevKvixNhHIyq94JbO-10jwdVWMHbkjUGEl01&t=633853107000000000" type="text/javascript"></script>
<script src="/JetExpress/ScriptResource.axd?d=IVG8uIra7OTJCAD3A4tGElW9l5BuyxY9FcfYMzb1MZzlT27BliTfrWMCr32VscTT1PZimjlD0AlLul1eP6p59RixJJZ8W_649PHF-QCus7mYFm0h-QoLriF8ErKlyVZi0&t=633853107000000000" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
<div>
<input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="cvZzvOunzdI4mFHTNE9gdawEugf1T6irVVez78oO4VMWKMs9qYQhpZpxISYyDC2rhrZ2VfBBq/wzx37L1lZsssYEh7B4TJYaNuT4r6RIFIn30H63eFnzcbW/E9MfOUxL9CiNglK5P2OR+/juOV1Z4QCYnWVWVHt9mw0LArG+q2i4plvWUjMC+Mnrji1Y7gJ/povRH80ue0xxZmYam4RiNTXRzXwuqx0y2RkNWRSNFXUVl78qBr3u1b5WL88qiVkFeocVuegcLyBpuXIVR6nBeBLsvw2f6cPldU5BHoiq5mizggC5bqUlb43YdFhfFdv0ya64DlKigCwR59eRmFXHB9IxXWM5JRDc0ajBzzBaTuMt5dSiKkINF8wcw8wfAQl4pq7S+IF8whPtOCsSY6WeX1uNzUyTimWrzrvDHy+EIT7YfbKH28UxJoHB5qXmlkBBwIoks9DkSbyjF4cr3SK/VdFm2OrHjCAdnF58CbozR5xL3JFxW9b3tGHGvoFr9AAvvYT7QcsJzfETxHZ4kdnEWMhz7ruHP1lnVQ5Itlde4KB7mgh4N/zYUuX1GbvT13xL" />
</div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
</script>
<div>
<span id="Label11" style="display:inline-block;color:#006E2E;background-color:#CDEB8B;font-size:Large;font-weight:bold;width:197px;">New/ Edit Party Details</span>
<span id="LoginName1" style="position: relative">jetkolkata</span>
<a id="LoginStatus1" href="javascript:__doPostBack('LoginStatus1$ctl00','')" style="position: relative">Logout</a>
<br />
<br />
<table style="position: relative">
<tr>
<td style="width: 184px">
<span id="Label1" style="position: relative">Party Id</span></td>
<td style="width: 397px">
<input name="TextBoxId" type="text" id="TextBoxId" style="width:376px;position: relative" />
<span style="color: #ff0066">*</span></td>
<td style="width: 171px">
<span id="RequiredFieldValidator1" style="color:Red;position:relative;visibility:hidden;">Party Id is required</span></td>
</tr>
<tr>
<td style="width: 184px">
<span id="Label2" style="position: relative">Party Name</span></td>
<td style="width: 397px">
<input name="TextBoxName" type="text" id="TextBoxName" style="width:376px;position: relative" />
<span style="color: #ff0066">*</span></td>
<td style="width: 171px">
<span id="RequiredFieldValidator2" style="color:Red;position:relative;visibility:hidden;">Party Name is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 18px;">
<span id="Label3" style="position: relative">Office Address</span></td>
<td style="width: 397px; height: 18px;">
<textarea name="TextBoxAddress" rows="5" cols="20" id="TextBoxAddress" style="width:376px;position: relative"></textarea>
<span style="color: #ff0066">*</span></td>
<td style="width: 171px; height: 18px;">
<span id="RequiredFieldValidator3" style="color:Red;position:relative;visibility:hidden;">Office address is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label4" style="position: relative">State</span></td>
<td style="width: 397px; height: 17px">
<select name="DropDownList1" id="DropDownList1" style="width:381px;position: relative">
<option value="ANDAMAN & NICOBAR ISLANDS">ANDAMAN & NICOBAR ISLANDS</option>
<option value="ANDHRA PRADESH">ANDHRA PRADESH</option>
<option value="ARUNACHAL PRADESH">ARUNACHAL PRADESH</option>
<option value="ASSAM">ASSAM</option>
<option value="BIHAR">BIHAR</option>
<option value="Chandigarh">Chandigarh</option>
<option value="CHHATTISGARH">CHHATTISGARH</option>
<option value="DADRA & NAGAR HAVELI">DADRA & NAGAR HAVELI</option>
<option value="DAMAN & DIU">DAMAN & DIU</option>
<option value="DELHI">DELHI</option>
<option value="GOA">GOA</option>
<option value="GUJARAT">GUJARAT</option>
<option value="HARYANA">HARYANA</option>
<option value="HIMACHAL PRADESH">HIMACHAL PRADESH</option>
<option value="JAMMU & KASHMIR">JAMMU & KASHMIR</option>
<option value="JHARKHAND">JHARKHAND</option>
<option value="KARNATAKA">KARNATAKA</option>
<option value="KERALA">KERALA</option>
<option value="LAKSHADWEEP">LAKSHADWEEP</option>
<option value="MADHYA PRADESH">MADHYA PRADESH</option>
<option value="MAHARASHTRA">MAHARASHTRA</option>
<option value="MANIPUR">MANIPUR</option>
<option value="MEGHALAYA">MEGHALAYA</option>
<option value="MIZORAM">MIZORAM</option>
<option value="NAGALAND">NAGALAND</option>
<option value="ORISSA">ORISSA</option>
<option value="PONDICHERRY">PONDICHERRY</option>
<option value="PUNJAB">PUNJAB</option>
<option value="RAJASTHSAN">RAJASTHSAN</option>
<option value="SIKKIM">SIKKIM</option>
<option value="TAMIL NADU">TAMIL NADU</option>
<option value="TRIPURA">TRIPURA</option>
<option value="UTTAR PRADESH">UTTAR PRADESH</option>
<option value="UTTARANCHAL">UTTARANCHAL</option>
<option value="WEST BENGAL">WEST BENGAL</option>
</select></td>
<td style="width: 171px; height: 17px">
</td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label5" style="position: relative">City/ Nearby City</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxCity" type="text" id="TextBoxCity" style="width:376px;position: relative" />
<span style="color: #ff0066">*</span></td>
<td style="width: 171px; height: 17px">
<span id="RequiredFieldValidator4" style="color:Red;position:relative;visibility:hidden;">City is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label6" style="position: relative">Pin</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxpin" type="text" id="TextBoxpin" style="width:376px;position: relative" />
<span style="color: #ff0066">*</span></td>
<td style="width: 171px; height: 17px">
<span id="RequiredFieldValidator5" style="color:Red;position:relative;visibility:hidden;">Pin Code is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label7" style="position: relative">Phone [Land Line]</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxPhone" type="text" id="TextBoxPhone" style="width:376px;position: relative" />
<span style="color: #ff0066">*</span></td>
<td style="width: 171px; height: 17px">
<span id="RequiredFieldValidator6" style="color:Red;position:relative;visibility:hidden;">Phone Number(s) is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label13" style="position: relative">Fax</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxFax" type="text" id="TextBoxFax" style="width:376px;position: relative" /></td>
<td style="width: 171px; height: 17px">
</td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label8" style="position: relative">Mobile</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxMobile" type="text" id="TextBoxMobile" style="width:376px;position: relative" /> </td>
<td style="width: 171px; height: 17px">
</td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label9" style="position: relative">Email Id</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxEmail" type="text" id="TextBoxEmail" style="width:376px;position: relative" /></td>
<td style="width: 171px; height: 17px">
<span id="RegularExpressionValidator1" style="color:Red;position:relative;visibility:hidden;">Not a valid email format</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label10" style="position: relative">Contact Person</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxContact" type="text" id="TextBoxContact" style="width:376px;position: relative" /></td>
<td style="width: 171px; height: 17px">
</td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
<span id="Label14" style="position: relative">Excess Rate/ Kg</span></td>
<td style="width: 397px; height: 17px">
<input name="TextBoxExcess" type="text" maxlength="5" id="TextBoxExcess" style="width:376px;position: relative" /></td>
<td style="width: 171px; height: 17px">
<span id="RequiredFieldValidator7" style="color:Red;position:relative;visibility:hidden;">Rate is required</span></td>
</tr>
<tr>
<td style="width: 184px; height: 17px">
</td>
<td style="width: 397px; height: 17px">
<input type="submit" name="Button1" value="Save Party Details" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("Button1", "", true, "EntryGroup", "", false, false))" id="Button1" style="left: 222px; position: relative; top: 1px" /><input type="submit" name="ButtonEdit" value="Cancel Edit" id="ButtonEdit" disabled="disabled" style="width:109px;left: -59px; position: relative;
top: 0px" /></td>
<td style="width: 171px; height: 17px">
</td>
</tr>
</table>
</div>
<br />
<br />
<br />
<br />
<br />
<div id="Panel1" style="position: relative">
<span id="Label12" style="display:inline-block;color:#006E2E;background-color:#CDEB8B;font-size:Large;font-weight:bold;width:190px;position: relative">Existing Party Details</span><br />
<br />
<div>
<table cellspacing="0" cellpadding="4" rules="cols" border="1" id="GridView1" style="color:Black;background-color:White;border-color:#DEDFDE;border-width:1px;border-style:None;width:952px;border-collapse:collapse;position: relative; left: 0px; top: 4px;">
<tr style="color:White;background-color:#6B696B;font-weight:bold;">
<th scope="col"> </th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$sl')" style="color:White;">Sl</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$PartyId')" style="color:White;">Party Id</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$partyname')" style="color:White;">Party Name</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Address')" style="color:White;">Address</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$State')" style="color:White;">State</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$City')" style="color:White;">City</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Pin')" style="color:White;">Pin</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Phone')" style="color:White;">Phone</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Fax')" style="color:White;">Fax</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$Mobile')" style="color:White;">Mobile</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$EmailId')" style="color:White;">EmailId</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$ContactPerson')" style="color:White;">Contact Person</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$ExcessRate')" style="color:White;">Excess Rate</a></th><th scope="col"><a href="javascript:__doPostBack('GridView1','Sort$partykey')" style="color:White;"></a></th>
</tr><tr style="background-color:#F7F7DE;">
<td>
<input type="submit" name="GridView1$ctl02$ButtonUpdate" value="Update Deatils" id="GridView1_ctl02_ButtonUpdate" style="position: relative" />
</td><td>2</td><td>ioc</td><td>Indian Oil Corporation</td><td>Beside Dakhhinapan shopping complex Dhakuria</td><td>WEST BENGAL</td><td>Kolkata</td><td>700031</td><td>03324159865/24159876</td><td>34543543</td><td>-</td><td>ds@ss.com</td><td>-</td><td> </td><td style="width:0px;">bcQICYRPOB6fsiHYSXYR1IQ1Gh0sUx</td>
</tr><tr style="background-color:White;">
<td>
<input type="submit" name="GridView1$ctl03$ButtonUpdate" value="Update Deatils" id="GridView1_ctl03_ButtonUpdate" style="position: relative" />
</td><td>3</td><td>bpcl</td><td>Bharat Petroleum</td><td>May be near Taratala</td><td>WEST BENGAL</td><td>Kolkata</td><td>700105</td><td>03324159865/24159876</td><td>-</td><td>-</td><td>-</td><td>-</td><td>Rs.12.00</td><td style="width:0px;">4ghKd3gsTDxtYqDn57IWsgzKhaCflJ</td>
</tr><tr style="background-color:#F7F7DE;">
<td>
<input type="submit" name="GridView1$ctl04$ButtonUpdate" value="Update Deatils" id="GridView1_ctl04_ButtonUpdate" style="position: relative" />
</td><td>4</td><td> </td><td> </td><td> </td><td>ANDAMAN & NICOBAR ISLANDS</td><td> </td><td> </td><td> </td><td> </td><td>-</td><td>-</td><td>-</td><td> </td><td style="width:0px;">Y8H8iMxViXxr6iCs8gF6MR2qqr9WtX</td>
</tr><tr style="background-color:White;">
<td>
<input type="submit" name="GridView1$ctl05$ButtonUpdate" value="Update Deatils" id="GridView1_ctl05_ButtonUpdate" style="position: relative" />
</td><td>6</td><td>dd</td><td> </td><td> </td><td>ANDAMAN & NICOBAR ISLANDS</td><td> </td><td> </td><td> </td><td> </td><td>-</td><td>-</td><td>-</td><td> </td><td style="width:0px;">4Xg9H8cLooBgqBnE6z7cQFth9ixMtK</td>
</tr><tr style="background-color:#F7F7DE;">
<td>
<input type="submit" name="GridView1$ctl06$ButtonUpdate" value="Update Deatils" id="GridView1_ctl06_ButtonUpdate" style="position: relative" />
</td><td>9</td><td>ddddd</td><td>test</td><td>sdfgds fsd sdf</td><td>ANDAMAN &amp; NICOBAR ISLANDS</td><td>jjjjjjj</td><td>455555</td><td>46454646</td><td> </td><td>-</td><td>-</td><td>-</td><td> </td><td style="width:0px;">niTgdLrNY4hlg2VJSrrJ90dUt6my6h</td>
</tr><tr style="background-color:White;">
<td>
<input type="submit" name="GridView1$ctl07$ButtonUpdate" value="Update Deatils" id="GridView1_ctl07_ButtonUpdate" style="position: relative" />
</td><td>10</td><td>34dsfdsfds</td><td>Indian Oil Corporation</td><td>Beside Dakhhinapan shopping complex Dhakuria</td><td>WEST BENGAL</td><td>Kolkata</td><td>700031</td><td>03324159865/24159876</td><td>4565464</td><td>-</td><td>ds@ss.com</td><td>-</td><td> </td><td style="width:0px;">Ko9h9tVrWpNqcPI6sSOxDmMNDEDMhh</td>
</tr>
</table>
</div>
</div>
<br />
<br />
<br />
<script type="text/javascript">
//<![CDATA[
var Page_Validators = new Array(document.getElementById("RequiredFieldValidator1"), document.getElementById("RequiredFieldValidator2"), document.getElementById("RequiredFieldValidator3"), document.getElementById("RequiredFieldValidator4"), document.getElementById("RequiredFieldValidator5"), document.getElementById("RequiredFieldValidator6"), document.getElementById("RegularExpressionValidator1"), document.getElementById("RequiredFieldValidator7"));
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var RequiredFieldValidator1 = document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1");
RequiredFieldValidator1.controltovalidate = "TextBoxId";
RequiredFieldValidator1.errormessage = "Party Id is required";
RequiredFieldValidator1.validationGroup = "EntryGroup";
RequiredFieldValidator1.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator1.initialvalue = "";
var RequiredFieldValidator2 = document.all ? document.all["RequiredFieldValidator2"] : document.getElementById("RequiredFieldValidator2");
RequiredFieldValidator2.controltovalidate = "TextBoxName";
RequiredFieldValidator2.errormessage = "Party Name is required";
RequiredFieldValidator2.validationGroup = "EntryGroup";
RequiredFieldValidator2.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator2.initialvalue = "";
var RequiredFieldValidator3 = document.all ? document.all["RequiredFieldValidator3"] : document.getElementById("RequiredFieldValidator3");
RequiredFieldValidator3.controltovalidate = "TextBoxAddress";
RequiredFieldValidator3.errormessage = "Office address is required";
RequiredFieldValidator3.validationGroup = "EntryGroup";
RequiredFieldValidator3.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator3.initialvalue = "";
var RequiredFieldValidator4 = document.all ? document.all["RequiredFieldValidator4"] : document.getElementById("RequiredFieldValidator4");
RequiredFieldValidator4.controltovalidate = "TextBoxCity";
RequiredFieldValidator4.errormessage = "City is required";
RequiredFieldValidator4.validationGroup = "EntryGroup";
RequiredFieldValidator4.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator4.initialvalue = "";
var RequiredFieldValidator5 = document.all ? document.all["RequiredFieldValidator5"] : document.getElementById("RequiredFieldValidator5");
RequiredFieldValidator5.controltovalidate = "TextBoxpin";
RequiredFieldValidator5.errormessage = "Pin Code is required";
RequiredFieldValidator5.validationGroup = "EntryGroup";
RequiredFieldValidator5.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator5.initialvalue = "";
var RequiredFieldValidator6 = document.all ? document.all["RequiredFieldValidator6"] : document.getElementById("RequiredFieldValidator6");
RequiredFieldValidator6.controltovalidate = "TextBoxPhone";
RequiredFieldValidator6.errormessage = "Phone Number(s) is required";
RequiredFieldValidator6.validationGroup = "EntryGroup";
RequiredFieldValidator6.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator6.initialvalue = "";
var RegularExpressionValidator1 = document.all ? document.all["RegularExpressionValidator1"] : document.getElementById("RegularExpressionValidator1");
RegularExpressionValidator1.controltovalidate = "TextBoxEmail";
RegularExpressionValidator1.errormessage = "Not a valid email format";
RegularExpressionValidator1.validationGroup = "EntryGroup";
RegularExpressionValidator1.evaluationfunction = "RegularExpressionValidatorEvaluateIsValid";
RegularExpressionValidator1.validationexpression = "\\w+([-+.\']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
var RequiredFieldValidator7 = document.all ? document.all["RequiredFieldValidator7"] : document.getElementById("RequiredFieldValidator7");
RequiredFieldValidator7.controltovalidate = "TextBoxExcess";
RequiredFieldValidator7.errormessage = "Rate is required";
RequiredFieldValidator7.validationGroup = "EntryGroup";
RequiredFieldValidator7.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid";
RequiredFieldValidator7.initialvalue = "";
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
Sys.Application.initialize();
document.getElementById('RequiredFieldValidator1').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator1'));
}
document.getElementById('RequiredFieldValidator2').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator2'));
}
document.getElementById('RequiredFieldValidator3').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator3'));
}
document.getElementById('RequiredFieldValidator4').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator4'));
}
document.getElementById('RequiredFieldValidator5').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator5'));
}
document.getElementById('RequiredFieldValidator6').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator6'));
}
document.getElementById('RegularExpressionValidator1').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RegularExpressionValidator1'));
}
document.getElementById('RequiredFieldValidator7').dispose = function() {
Array.remove(Page_Validators, document.getElementById('RequiredFieldValidator7'));
}
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":15,"ValidChars":"-/.","id":"FilteredTextBoxExtenderId"}, null, null, $get("TextBoxId"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":"./\\- ","id":"FilteredTextBoxExtenderName"}, null, null, $get("TextBoxName"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":2,"id":"FilteredTextBoxExtenderPin"}, null, null, $get("TextBoxpin"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":15,"ValidChars":"-/., ","id":"FilteredTextBoxExtenderAddress"}, null, null, $get("TextBoxAddress"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":11,"ValidChars":"-._@","id":"FilteredTextBoxExtenderEmail"}, null, null, $get("TextBoxEmail"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"-/.()+,","id":"FilteredTextBoxExtenderPhone"}, null, null, $get("TextBoxPhone"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"-/.()+,","id":"FilteredTextBoxExtenderFax"}, null, null, $get("TextBoxFax"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":"-/.()+,","id":"FilteredTextBoxExtenderMobile"}, null, null, $get("TextBoxMobile"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":13,"ValidChars":"-/. ","id":"FilteredTextBoxExtenderCity"}, null, null, $get("TextBoxCity"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":15,"ValidChars":"-/. (),","id":"FilteredTextBoxExtendercontact"}, null, null, $get("TextBoxContact"));
});
Sys.Application.add_init(function() {
$create(AjaxControlToolkit.FilteredTextBoxBehavior, {"FilterType":3,"ValidChars":".","id":"FilteredTextBoxExtender1"}, null, null, $get("TextBoxExcess"));
});
//]]>
</script>
</form>
</body>
</html>
suraj singh ...
Member
18 Points
11 Posts
Re: What is the difference between view state and a hidden field
Jul 30, 2012 05:54 PM|LINK
Well if im not wrong than viewstate creates a hashed string whisch is more secure than Hidden fields