Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 21, 2007 01:19 AM by Rex Lin - MSFT
Jun 20, 2007 12:53 AM|LINK
I have changed my code and first I go thru and find the checked ones then I want to bind with dropdown
So, I have done this and it does give me two key values, if I checked two checkboxes, but on my second for each loop, it is giving me error, because probably I didn't set that correct format
key = GridView1.DataKeys(row.RowIndex)
GridView1.EditIndex = row.RowIndex
Jun 20, 2007 07:47 AM|LINK
GridView.Rows collection is a collection of a GridViewRow. You try to use variable key which is DataKey.
Did you mean
for each row in GridView1.Rows?
Jun 20, 2007 05:04 PM|LINK
since my first part of code gives me two or more keys, I need to see if values of each key = 21 or not if it is not <>21 I want this row to be edit mode. How can I do that for the second part of code?
Jun 20, 2007 06:38 PM|LINK
I have tried this way, and even though I set my txtmessage = "" still at the end, I see two values in that text box,why is that?
Dim key As DataKey
Jun 20, 2007 09:47 PM|LINK
I am not sure what you are asking..
Response.Write(CType(key.Value, Integer)) - writeys some value to response. where do you expect to get it?
Jun 21, 2007 01:19 AM|LINK
Adding Controls at the Right Time
We already know that when adding controls dynamically through the page's code portion the controls must be added on every postback. But when in the page lifecycle should the controls be added? At first guess, we might decide to put such code in the
If we need our dynamically added controls to maintain their view state it is paramount that these controls be added before the Load View State stage. That is, these controls must exist within the page's control hierarchy before the view state is loaded. There's only one stage before Load View State - Initialization. That means, if we want our dynamic controls to persist view state we must add them to the control hierarchy in the page's
If you are using Visual Studio .NET, the code-behind class already contains an event handler for the page's
Here are some corresponding material for you:
I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance