Link to home
Start Free TrialLog in
Avatar of Dustin Hopkins
Dustin HopkinsFlag for United States of America

asked on

reference gridview dataitem in rowediting event

Ok I have a gridview bound to a sql datasource, on of the fields it returns is a pipe delimited string.
I use a template control with a label in the item template that sends the string to a function that splits it and displays a ul.

now in the edit item template i have a checkbox list. When the user clicks the edit button, I want to reference the control and the dataitem, loop through it and select certain checkboxes.

I can reference the checkbox list fine, but how can i get the dataitem?
Or is there a better way to do this?
Avatar of prairiedog
prairiedog
Flag of United States of America image

>>>I want to reference the control and the dataitem,
Which control do you want to reference? The label?
Avatar of Dustin Hopkins

ASKER

No i want to reference the checkboxlist, did that with no problem.

Its the dataitem thats giving me the problem, i tried using the eval.databinder method like you would use in the onrowdatabound event, but its throwing object reference not set to an instance of the object.
Can you post the code that you reference the checkboxlist and the code you use to get the dataitem?
ASKER CERTIFIED SOLUTION
Avatar of Dustin Hopkins
Dustin Hopkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
do you mean to access the gridview.rowediting event ?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowediting.aspx

waiting for your reply
No, I was having problems referencing the dataitem associtated with a row during the rowediting event. I didn't realize that that was done in the rowdatabound event. As the row rebinds when switching to an editing view. Basically i was storing a string of data in a single db column, seperated by pipes. Such as "one|two|three". Then I took this and broke it down and used it to fill a checkboxlist. Thanks though.