Hey all!
I am trying to establish an administration style feature to my datagrid by providing an option to "switch on" an edit and delete column. I currently have the following code:
private void btnAdminOn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
btnAdminOff.Visible = true;
btnAdminOn.Visible = false;
EditCommandColumn edit = new EditCommandColumn();
// edit.ButtonType = "PushButton";
edit.UpdateText = "Update";
edit.CancelText = "Cancel";
edit.EditText= "Edit";
ButtonColumn delete = new ButtonColumn();
delete.Text = "Delete";
delete.CommandName = "Delete";
DataGrid1.Columns.Add(edit);
DataGrid1.Columns.Add(delete);
if ( !IsPostBack )
{
DataGrid1.DataSource = ds;
DataGrid1.DataBind ( );
}
}
The reason i have the "ButtonType" line of code commented out is due to an error i was receiving: "Cannot implicitly convert type 'string' to System.Web.UI.WebControls.ButtonColumnType'"
Could this be the reason i am having no luck?
Thanks in advance for any help.
GavW
I am trying to establish an administration style feature to my datagrid by providing an option to "switch on" an edit and delete column. I currently have the following code:
private void btnAdminOn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
btnAdminOff.Visible = true;
btnAdminOn.Visible = false;
EditCommandColumn edit = new EditCommandColumn();
// edit.ButtonType = "PushButton";
edit.UpdateText = "Update";
edit.CancelText = "Cancel";
edit.EditText= "Edit";
ButtonColumn delete = new ButtonColumn();
delete.Text = "Delete";
delete.CommandName = "Delete";
DataGrid1.Columns.Add(edit);
DataGrid1.Columns.Add(delete);
if ( !IsPostBack )
{
DataGrid1.DataSource = ds;
DataGrid1.DataBind ( );
}
}
The reason i have the "ButtonType" line of code commented out is due to an error i was receiving: "Cannot implicitly convert type 'string' to System.Web.UI.WebControls.ButtonColumnType'"
Could this be the reason i am having no luck?
Thanks in advance for any help.
GavW