Here in Grid View, in the beginning the major part is to make the decision of putting either a bound field or a template field and the answer is simple: When we want to place any control inside the Grid View then we can go for template field, otherwise bound field will be simpler.
Now I will show you the C# code behind file of the above ASP.
NET page that will handle different Grid View events to provide complete editing functionality.
But ensure that the control/link is inside the Grid View, only then can we cast sender as Grid View.
This code is a bit complex but just add it knowing that we may refer to it in the future.
AARP_DATA_D1_Bill Matri It still gets the old values, when I loop thru the Dictionary and in debug step thru it I see it still gets the original values not the new values that the user enters when they are changing each item.
// Iterate through the New Values collection and HTML encode all // user-provided values before updating the data source. New Values) guru_sami, sorry it took me so long to get back, I have been off on vacation and just got back, but yes you are right on, I went back and debugged the entire postback and it was rebinding the grid on postback on the page_load event.
So i figured out as follow: on my Edit Item Template : This solution allowed me to show properly an html-encoded data for all of my Text Boxes and at the same time being able to access this data from the new Values array when the item_Updating event fires.
The visitors to a web site can typically be divided into two groups: the users and the administrators.
I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.
By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.
For example, the following syntax is invalid because it tries to invoke arbitrary code and use Bind() at the same time: The only formats supported in two-way databinding are Bind("field") and Bind("field", "format string ").