Padre_Corleone
asked on
Gridview Databinding help
I have a databind that returns all roles, the problem is would like to customize this control so that the actual role has all other columns included for example roleid, rolename, roledate etc.
the following only returns all roles and the header name is "item"
gvRoles.DataSource = System.Web.Security.Roles. GetAllRole s
gvRoles.DataBind()
<asp:GridView ID="gvRoles" runat="server" AutoGenerateColumns="true" AutoGenerateDeleteButton=" true" AutoGenerateEditButton="tr ue" AutoGenerateSelectButton=" true">
</asp:GridView>
SqlDataAdapter Adapter = new SqlDataAdapter(Command);
DataSet RolesDS = new DataSet();
try
{
SqlConn.Open();
Adapter.Fill(RolesDS);
int i = 0;
roles = new string[RolesDS.Tables[0].R ows.Count] ;
foreach (DataRow role in RolesDS.Tables[0].Rows)
{
roles[i] = role["RoleNames"].ToString ();
i++;
}
}
the following only returns all roles and the header name is "item"
gvRoles.DataSource = System.Web.Security.Roles.
gvRoles.DataBind()
<asp:GridView ID="gvRoles" runat="server" AutoGenerateColumns="true"
</asp:GridView>
SqlDataAdapter Adapter = new SqlDataAdapter(Command);
DataSet RolesDS = new DataSet();
try
{
SqlConn.Open();
Adapter.Fill(RolesDS);
int i = 0;
roles = new string[RolesDS.Tables[0].R
foreach (DataRow role in RolesDS.Tables[0].Rows)
{
roles[i] = role["RoleNames"].ToString
i++;
}
}
ASKER
RoleNames is the only Column return, how can i also get RoleID, CreatedDate
to display on my gridview?
to display on my gridview?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to have been helpful :)
Regards,
Max.
Regards,
Max.
Cause in that case you will probably need to extend upon the gridview control, so that you have a different look for a selected row, or even a mouseover row for that matter.
Is that what you mean or am I totally off base here.
Regards,
Max.