views:

15

answers:

1

Hi, I need some advice how to use DataKeys and DataItemIndex fro a GRIDVIEW.

I need take the values for an item "ROW" in a "GRIDVIEW" and associate it to "MembershipUser".

I get an error "Make sure all arguments to this method have valid values as defined by the invoked method."

Any ideas??? Thanks for your help BYE!

 protected void uxRoleCheckBoxSelector_CheckChanged(object sender, EventArgs e)
        {
            CheckBox activeCheckBox = (CheckBox)sender;
            GridViewRow row = (GridViewRow)activeCheckBox.NamingContainer;
            string myUserName = (string)uxUserListDisplayer.DataKeys[row.DataItemIndex].Value;
            MembershipUser myUser = Membership.GetUser(myUserName);

        }
+1  A: 

How many keys you have in datakeynames? if you have more than 1 key try:

uxUserListDisplayer.DataKeys[row.DataItemIndex]["Kayname"]

where keyname is the name of the kay you wanth read.

Flatlineato
thanks for your answer!
GIbboK