开发者

How to use DataKeys and DataItemIndex

开发者 https://www.devze.com 2023-01-20 18:12 出处:网络
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 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(myUse开发者_开发百科rName);

        }


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 key you wanth read.

0

精彩评论

暂无评论...
验证码 换一张
取 消