newbie to datagrids

X

Xarky

Hi,
I designed my datagrid as shown in the code below. I also succeded to
load the data into it.

Now I have added a push button remove, but I don't know how to handle
the event.

Can someone help me out.
Thanks in Advance


/******** for datagrid *********/
<asp:DataGrid DataKeyField="UserID" AutoGenerateColumns="False"
AllowSorting="True" CellPadding="3"
CellSpacing="2" id="dataGridShowUsers" style="Z-INDEX: 101; LEFT:
40px; POSITION: absolute; TOP: 160px"
runat="server" Width="674px" Height="216px" BorderColor="#CCCCCC"
BorderStyle="None" BorderWidth="1px"
BackColor="White">
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#006699"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="UserID" HeaderText="ID
Number"></asp:BoundColumn>
<asp:BoundColumn DataField="Name"
HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Surname"
HeaderText="Surname"></asp:BoundColumn>
<asp:EditCommandColumn HeaderText="Delete" EditText="Remove"
ButtonType="PushButton"></asp:EditCommandColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066"
BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>
 
E

Elton Wang

Hi Xarky,

What do you want to remove?

Elton Wang
(e-mail address removed)

-----Original Message-----
Hi,
I designed my datagrid as shown in the code below. I also succeded to
load the data into it.

Now I have added a push button remove, but I don't know how to handle
the event.

Can someone help me out.
Thanks in Advance


/******** for datagrid *********/
<asp:DataGrid DataKeyField="UserID" AutoGenerateColumns="False"
AllowSorting="True" CellPadding="3"
CellSpacing="2"
id="dataGridShowUsers" style="Z-INDEX: 101; LEFT:
40px; POSITION: absolute; TOP: 160px"
runat="server"
Width="674px" Height="216px" BorderColor="#CCCCCC"
BorderStyle="None" BorderWidth="1px"
BackColor="White">
<FooterStyle
ForeColor="#000066" BackColor="White"> said:
<SelectedItemStyle Font- Bold="True" ForeColor="White"
BackColor="#669999"></SelectedItemStyle>
<ItemStyle
ForeColor="#000066"> said:
<HeaderStyle Font- Bold="True" ForeColor="White"
BackColor="#006699"></HeaderStyle>
<Columns>
<asp:BoundColumn
DataField="UserID" HeaderText="ID
Number"></asp:BoundColumn>
<asp:BoundColumn DataField="Name"
DataField="Surname"
HeaderText="Surname"></asp:BoundColumn>
<asp:EditCommandColumn HeaderText="Delete"
EditText="Remove"
ButtonType="PushButton"></asp:EditCommandColumn>
</Columns>
<PagerStyle
HorizontalAlign="Left" ForeColor="#000066"
 
X

xarky d_best

Hi,
In the datagrid I am representing a table of my database, ie a row in
datagrid is equivalent to a row in a table.

Now with remove I mean to remove a row from the table, that is by
calling an sql command with a known primary key that is also given in
the datagrid.

What I require, that on the click event of the button, I get the value
of the primary key, and call the sql statement for deletion.

Thanks in Advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top