datagrid commands

R

Roel

Hello,

I built an application that shows the file of a folder on a website.

I present it by using a datagrid. Now, I want to add some functionalities to
the datagrid like, the possibility to delete the file. Therefore I use the
deletecommand -event. But I also want to add print functionality... Does
anyone knows how I can add a linkbutton to the datagrid that throws a
specific event (ex. printcommand) ?

Regards
Roel
 
M

mortb

Something like this:

<asp:datagrid id="myGrid" runat="server">
<Columns>
<asp:BoundColumn DataField="ItemName" Visible="False" />
<asp:ButtonColumn ItemStyle-VerticalAlign="Top"
ButtonType="LinkButton" Text="Print..." CommandName="cmdPrint" />
</Columns>
</asp:datagrid>


protected void gridModules_ItemCommand(object source,
DataGridCommandEventArgs e)
{
if(e.CommandName == "cmdPrint")
{
//do your stuff
}
}

cheers,
mortb
 

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

Similar Threads


Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top