|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGrid not calling ItemCommand EventItemCommand event. I tried do to it defining the event as usual (from the designer), but it didn't work, neither defining the event in the .aspx. the aspx datagrid tag: <asp:datagrid id="grdOilFields" runat="server" BorderColor="#999999" GridLines="Vertical" HorizontalAlign="Center" AutoGenerateColumns="False" Font-Names="Arial" Font-Size="X-Small" CssClass="cssTabla" OnItemCommand="grdOilFields_ItemCommand"> <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> <ItemStyle Height="24px" ForeColor="Black" BackColor="#EEEEEE"></ItemStyle> <HeaderStyle Height="24px"></HeaderStyle> <Columns> <asp:BoundColumn HeaderText="Descripción"> <HeaderStyle Width="145px" CssClass="LeftHeaderImage"></HeaderStyle> <ItemStyle Width="145px"></ItemStyle> </asp:BoundColumn> <asp:TemplateColumn> <HeaderStyle Width="45px" CssClass="RightHeaderImage"></HeaderStyle> <ItemStyle Width="45px"></ItemStyle> <ItemTemplate> <asp:ImageButton id="btnDelete" runat="server" ImageUrl="../Images/Buttons/DGDelete.gif" CommandName="btnDelete"></asp:ImageButton> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:datagrid> the way I defined the event handler: protected void grdOilFields_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { ... some code which is never reached ... } if you have any ideas about why this event is never reached, please tell me, thanks do you have data available?
-- Show quoteHide quoteRegards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The Microsoft Office Web Components Black Book with .NET Now Available @ www.lulu.com/owc Forth-coming VSTO.NET - Wrox/Wiley 2006 ------------------------------------------------------- "Ezequiel Pérez" <eaz***@gmail.com> wrote in message news:OcAlHaXXGHA.752@TK2MSFTNGP02.phx.gbl... > Hi, I have a problem with a DataGrid, this datagrid is not calling the > ItemCommand event. I tried do to it defining the event as usual (from the > designer), but it didn't work, neither defining the event in the .aspx. > > the aspx datagrid tag: > > <asp:datagrid id="grdOilFields" runat="server" BorderColor="#999999" > GridLines="Vertical" HorizontalAlign="Center" AutoGenerateColumns="False" > Font-Names="Arial" Font-Size="X-Small" CssClass="cssTabla" > OnItemCommand="grdOilFields_ItemCommand"> > <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> > <ItemStyle Height="24px" ForeColor="Black" > BackColor="#EEEEEE"></ItemStyle> > <HeaderStyle Height="24px"></HeaderStyle> > <Columns> > <asp:BoundColumn HeaderText="Descripción"> > <HeaderStyle Width="145px" CssClass="LeftHeaderImage"></HeaderStyle> > <ItemStyle Width="145px"></ItemStyle> > </asp:BoundColumn> > <asp:TemplateColumn> > <HeaderStyle Width="45px" CssClass="RightHeaderImage"></HeaderStyle> > <ItemStyle Width="45px"></ItemStyle> > <ItemTemplate> > <asp:ImageButton id="btnDelete" runat="server" > ImageUrl="../Images/Buttons/DGDelete.gif" > CommandName="btnDelete"></asp:ImageButton> > </ItemTemplate> > </asp:TemplateColumn> > </Columns> > </asp:datagrid> > > the way I defined the event handler: > > protected void grdOilFields_ItemCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > ... some code which is never reached ... > } > > if you have any ideas about why this event is never reached, please tell > me, thanks Try adding a Select command type column to the grid, from the designer
Show quoteHide quote "Ezequiel Pérez" <eaz***@gmail.com> wrote in message news:OcAlHaXXGHA.752@TK2MSFTNGP02.phx.gbl... > Hi, I have a problem with a DataGrid, this datagrid is not calling the > ItemCommand event. I tried do to it defining the event as usual (from the > designer), but it didn't work, neither defining the event in the .aspx. > > the aspx datagrid tag: > > <asp:datagrid id="grdOilFields" runat="server" BorderColor="#999999" > GridLines="Vertical" HorizontalAlign="Center" AutoGenerateColumns="False" > Font-Names="Arial" Font-Size="X-Small" CssClass="cssTabla" > OnItemCommand="grdOilFields_ItemCommand"> > <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> > <ItemStyle Height="24px" ForeColor="Black" > BackColor="#EEEEEE"></ItemStyle> > <HeaderStyle Height="24px"></HeaderStyle> > <Columns> > <asp:BoundColumn HeaderText="Descripción"> > <HeaderStyle Width="145px" CssClass="LeftHeaderImage"></HeaderStyle> > <ItemStyle Width="145px"></ItemStyle> > </asp:BoundColumn> > <asp:TemplateColumn> > <HeaderStyle Width="45px" CssClass="RightHeaderImage"></HeaderStyle> > <ItemStyle Width="45px"></ItemStyle> > <ItemTemplate> > <asp:ImageButton id="btnDelete" runat="server" > ImageUrl="../Images/Buttons/DGDelete.gif" > CommandName="btnDelete"></asp:ImageButton> > </ItemTemplate> > </asp:TemplateColumn> > </Columns> > </asp:datagrid> > > the way I defined the event handler: > > protected void grdOilFields_ItemCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > ... some code which is never reached ... > } > > if you have any ideas about why this event is never reached, please tell > me, thanks And you databind it initially inside if(!Page.IsPostBack){...} check?
Show quoteHide quote "Ezequiel Pérez" <eaz***@gmail.com> wrote in message news:OcAlHaXXGHA.752@TK2MSFTNGP02.phx.gbl... > Hi, I have a problem with a DataGrid, this datagrid is not calling the > ItemCommand event. I tried do to it defining the event as usual (from the > designer), but it didn't work, neither defining the event in the .aspx. > > the aspx datagrid tag: > > <asp:datagrid id="grdOilFields" runat="server" BorderColor="#999999" > GridLines="Vertical" HorizontalAlign="Center" AutoGenerateColumns="False" > Font-Names="Arial" Font-Size="X-Small" CssClass="cssTabla" > OnItemCommand="grdOilFields_ItemCommand"> > <AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle> > <ItemStyle Height="24px" ForeColor="Black" > BackColor="#EEEEEE"></ItemStyle> > <HeaderStyle Height="24px"></HeaderStyle> > <Columns> > <asp:BoundColumn HeaderText="Descripción"> > <HeaderStyle Width="145px" CssClass="LeftHeaderImage"></HeaderStyle> > <ItemStyle Width="145px"></ItemStyle> > </asp:BoundColumn> > <asp:TemplateColumn> > <HeaderStyle Width="45px" CssClass="RightHeaderImage"></HeaderStyle> > <ItemStyle Width="45px"></ItemStyle> > <ItemTemplate> > <asp:ImageButton id="btnDelete" runat="server" > ImageUrl="../Images/Buttons/DGDelete.gif" > CommandName="btnDelete"></asp:ImageButton> > </ItemTemplate> > </asp:TemplateColumn> > </Columns> > </asp:datagrid> > > the way I defined the event handler: > > protected void grdOilFields_ItemCommand(object source, > System.Web.UI.WebControls.DataGridCommandEventArgs e) > { > ... some code which is never reached ... > } > > if you have any ideas about why this event is never reached, please tell > me, thanks
return url value
Show ***** only if have a password How do I debug apsx pages? Datagrid custom paging always loads page 1 Validation inside composite controls for ASP .NET 2.0 Datagrid cancel command does not work when adding new record custom button/link in detailsview commandfield section How to set default values for fields in detailsview problem traping event in child control must click button twice for event to fire |
|||||||||||||||||||||||