#
tigermain
I've been using the gridview control quite happily all day then I went to try my code and it has screwed. The only difference I had made was to put the gridview in a panel/placeholder (tested both).
I am using the DataKey property, filling it with user.id's and using a button column to pass the itemindex through via commandargument (standard feature of gridview). I then use this to pull back the user.id from the datakeys collection.
This works fine if I have it sat on an page in the admin however when i put the same gridview in side a panel or placeholder container control the datakeys always returns an empty collection for the datakeys property
Any ideas, it must be a cuyahoga thing as I have tested it completely in a test rig without cuyahoga. Here's some sample's of my code....
I am using the DataKey property, filling it with user.id's and using a button column to pass the itemindex through via commandargument (standard feature of gridview). I then use this to pull back the user.id from the datakeys collection.
This works fine if I have it sat on an page in the admin however when i put the same gridview in side a panel or placeholder container control the datakeys always returns an empty collection for the datakeys property
Any ideas, it must be a cuyahoga thing as I have tested it completely in a test rig without cuyahoga. Here's some sample's of my code....
< asp:GridView ID="gvUserEntries" runat="server" OnRowCommand="gvUserEntries_RowCommand"
AutoGenerateColumns="false" DataKeyNames="Id" CssClass="tbl" UseAccessibleHeader="true"> this.gvUserEntries.DataSource = userService.FindUsersByRole(Convert.ToInt32(this.ddlRoles.SelectedValue));
this.gvUserEntries.DataBind(); protected void gvUserEntries_RowCommand(object sender, GridViewCommandEventArgs e)
{
Response.Redirect("UserEdit.aspx?UserId=" + this.gvUserEntries.DataKeys[Convert.ToInt32(e.CommandArgument)].Value, true);
}