J
Jeff User
Hello
..NET 1.1, VS 2003, C# & asp.net
I have tried to follow msdn instructions and samples but I can not get
an event to fire for this button on the datagrid.
There has to be something obvious missing here, but after 2 days I am
ready to explode ! Please help.
To create the Delete button I selected the grid in design view,
clicked the "Columns" property and added the Delete button in the
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteCommand" entry. On the C# page this created the :
private void dgPrivs_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgPrivs_DeleteCommand);
Clicking the Delete button on the pages causes it to post back, but
this event code never runs.
aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E0E4" BorderStyle="Outset" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="Grantor" ReadOnly="True"
HeaderText="Grantor"></asp:BoundColumn>
<asp:BoundColumn DataField="Grantee" ReadOnly="True"
HeaderText="Grantee"></asp:BoundColumn>
<asp:BoundColumn DataField="Object_Type" ReadOnly="True"
HeaderText="Object Type"></asp:BoundColumn>
<asp:BoundColumn DataField="Object_Name" ReadOnly="True"
HeaderText="Object Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Privilege_Type" ReadOnly="True"
HeaderText="Privilege"></asp:BoundColumn>
<asp:ButtonColumn Text="Delete" ButtonType="PushButton"
CommandName="Delete"></asp:ButtonColumn>
</Columns>
C# code bits
private void InitializeComponent()
{
this.dgPrivs.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgPrivs_DeleteCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
private void dgPrivs_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?
Thanks
Jeff
..NET 1.1, VS 2003, C# & asp.net
I have tried to follow msdn instructions and samples but I can not get
an event to fire for this button on the datagrid.
There has to be something obvious missing here, but after 2 days I am
ready to explode ! Please help.
To create the Delete button I selected the grid in design view,
clicked the "Columns" property and added the Delete button in the
properties page.
Then, I switched to the lightening bolt (events) and double clicked
the
"DeleteCommand" entry. On the C# page this created the :
private void dgPrivs_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{ etc....}
event procedure. It also apparently created the
initialize component entry:
this.dgPrivs.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgPrivs_DeleteCommand);
Clicking the Delete button on the pages causes it to post back, but
this event code never runs.
aspx page bit:
.......
<asp:datagrid id="dgPrivs" style="Z-INDEX: 110; LEFT: 256px; POSITION:
absolute; TOP: 176px" runat="server"
BackColor="#E0E0E4" BorderStyle="Outset" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="Grantor" ReadOnly="True"
HeaderText="Grantor"></asp:BoundColumn>
<asp:BoundColumn DataField="Grantee" ReadOnly="True"
HeaderText="Grantee"></asp:BoundColumn>
<asp:BoundColumn DataField="Object_Type" ReadOnly="True"
HeaderText="Object Type"></asp:BoundColumn>
<asp:BoundColumn DataField="Object_Name" ReadOnly="True"
HeaderText="Object Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Privilege_Type" ReadOnly="True"
HeaderText="Privilege"></asp:BoundColumn>
<asp:ButtonColumn Text="Delete" ButtonType="PushButton"
CommandName="Delete"></asp:ButtonColumn>
</Columns>
C# code bits
private void InitializeComponent()
{
this.dgPrivs.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgPrivs_DeleteCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
private void dgPrivs_DeleteCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string t ="ldsld";
t = t + "Resotr";
}
Do I need to add something else in here anywhere?
Is there anything else I should be looking for?
Thanks
Jeff