5
Reply

loaded usercontrol has a gridview whose selection is not showing in postback

ramzi hawa

ramzi hawa

May 20 2007 1:03 AM
3k
Hello,
"Loaded usercontrol has a gridview whose selection is not showing in postback"
I have a page main.aspx.cs that loads at runtime web controls (.ascx)

One of the controls has a gridview and when I select an item in the gridview I want to use this value in the main page (the main.aspx.cs) I have everything turned on (enable viewstate =true for the gridview)

I tried on selected index changed and selected index changing event handlers to assign the gridview1.selectedvalue to the viewstate but wasn't able to get anything in the postback instance of the page.

I was able to add the value to the session but not the viewstate. I can also add it to the page.form.attributes and recall it in the postback

The problem in the "page.form.attributes " is that the value called in the postback is not the last selected index, but it is delayed by 2 selected indexes, so it gives -1, 1, 2 instead of 1, 2 at consecutive postbacks when selecting first and second rows

(this is new)
I tried to response.write in the loaded control the value of gridview1.selected index on the control's page load event and it gives a delay of 1 browser trip


ramzi1978 at hotmail thanks

Answers (5)
Next Recommended Forum