problem with buttons on a datagrid

Bill Humphrey

Active member
Joined
Apr 10, 2008
Messages
35
Programming Experience
Beginner
Hi

I'm using VS2005

I have three controls embedded in a page using MultiView

one of the controls is a dynamic datagrid with create, edit and delete buttons

when I click on one of the buttons, the following method should be activated but it is not:

Public Sub MaintainImaging_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgImaging.ItemCommand

If Trim(lcommandname) = "AddPatientImage" Then
ElseIf Trim(lcommandname) = "DeletePatientImage" Then

ElseIf Trim(lcommandname) = "EditPatientImage" Then

'End If

End Sub





HTML DataGrid

<asp:datagrid id="dgImaging" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnItemCreated="dgImaging_ItemCreated"

pagesize="8" onItemCommand="MaintainImaging_Click" PagerStyle-Visible="False">

<Columns>

<asp:BoundColumn Visible="False" HeaderText="anchor"></asp:BoundColumn>

<asp:TemplateColumn ItemStyle-Wrap="False">

<HeaderStyle CssClass="menulabels"></HeaderStyle>

<ItemStyle Wrap="False" CssClass="menulabels" VerticalAlign="Top"></ItemStyle>

<ItemTemplate>

<asp:imagebutton toolTip="View Imaging Details" runat="server" imageurl="../images/icon_view.gif"

ID="fBTNViewImagingDetails" CommandName="ViewImagingDetails"></asp:imagebutton>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn>

<HeaderStyle CssClass="menulabels"></HeaderStyle>

<ItemStyle Wrap="False" CssClass="menulabels" VerticalAlign="Top"></ItemStyle>

<HeaderTemplate>

<asp:imagebutton toolTip="Add Patient Image" runat="server" imageurl="../images/icon_add.gif" ID="fBTNAddPatientImage"

CommandName="AddPatientImage" />

</HeaderTemplate>

<ItemTemplate>

<asp:imagebutton toolTip="Delete Patient Image" runat="server" imageurl="../images/icon_delete.gif"

ID="fBTNDeletePatientImage" CommandName="DeletePatientImage"></asp:imagebutton>

<asp:imagebutton toolTip="Edit Patient Image" runat="server" imageurl="../images/icon_edit.gif" ID="fBTNEditPatientImage"

CommandName="EditPatientImage"></asp:imagebutton>

</ItemTemplate>

</asp:TemplateColumn>

<asp:TemplateColumn ItemStyle-Wrap="False">

<HeaderStyle CssClass="menulabels"></HeaderStyle>

<ItemStyle Wrap="False" CssClass="menulabels" VerticalAlign="Top"></ItemStyle>

<ItemTemplate>

<asp:imagebutton toolTip="View Imaging Presentation" runat="server" imageurl="../images/icon_screen2.gif"

ID="fBTNViewImagingPresentation" CommandName="ViewImagingPresentation" ></asp:imagebutton>

</ItemTemplate>

</asp:TemplateColumn>

</Columns>

<PagerStyle Visible="False"></PagerStyle>

</asp:datagrid>
 
I'm pretty sure I've used the RowCommand event and not ItemCommand in the past and then e.CommandName to determine which button was pressed.
 
Back
Top