One other question. Are you using Codebehind or inline code? This matters because on inline code, the events are hooked up automatically, and codebehind can get change things based on whether there is a button on the datagrid at compiletime.
Ben Miller ----- Original Message ----- From: Psychomaniac To: [EMAIL PROTECTED] Sent: Wednesday, September 22, 2004 10:08 AM Subject: RE: [AspNetAnyQuestionIsOk] Dynamic Datagrids Yes, I actually still have those (OnEditCommand, OnCancelCommand and OnUpdateCommand) --- Rajendra Appalla <[EMAIL PROTECTED]> wrote: > I hope you still have this in the HTML part of the > datagrid. > > OnEditCommand="ItemsGrid_Edit" > OnCancelCommand="ItemsGrid_Cancel" > OnUpdateCommand="ItemsGrid_Update" > > Rajendra. > > -----Original Message----- > From: Psychomaniac > [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 22, 2004 11:33 AM > To: [EMAIL PROTECTED] > Subject: RE: [AspNetAnyQuestionIsOk] Dynamic > Datagrids > > Yes, I did that. But actually, those two piece of > code > did not even fire up any events the first time > called. > > > > > --- Rajendra Appalla <[EMAIL PROTECTED]> > wrote: > > > Are you adding those two columns again in > PostBack?? > > Because you > > should. The known behavior if you don't add those > > columns again in > > postback is that the events won't fire on those > > columns. > > > > Rajendra. > > > > -----Original Message----- > > From: Psychomaniac > > [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, September 22, 2004 5:39 AM > > To: [EMAIL PROTECTED] > > Subject: [AspNetAnyQuestionIsOk] Dynamic Datagrids > > > > Hi, I'm trying to build an ASP.NET display page > > using > > datagrid. This datagrid must contain: ButtonColumn > & > > EditCommandColumn. This is part of my code: > > > > <asp:DataGrid id="ItemsGrid" > > BorderColor="black" > > BorderWidth="1" > > CellPadding="3" > > OnEditCommand="ItemsGrid_Edit" > > OnCancelCommand="ItemsGrid_Cancel" > > OnUpdateCommand="ItemsGrid_Update" > > OnItemCommand="ItemsGrid_Command" > > AutoGenerateColumns="false" > > runat="server"> > > > > <HeaderStyle BackColor="#aaaadd"> > > </HeaderStyle> > > > > <Columns> > > > > <asp:EditCommandColumn > > EditText="Edit" > > CancelText="Cancel" > > UpdateText="Update" > > HeaderText="Edit item"> > > > > <ItemStyle Wrap="False"> > > </ItemStyle> > > > > <HeaderStyle Wrap="False"> > > </HeaderStyle> > > > > </asp:EditCommandColumn> > > > > <asp:ButtonColumn > > HeaderText="Delete item" > > ButtonType="LinkButton" > > Text="Delete" > > CommandName="Delete"/> > > > > Note that I also have defined "ItemsGrid_Edit", > > "ItemsGrid_Cancel", "ItemsGrid_Update" and > > "ItemsGrid_Command" in my VB code. > > > > It all works fine. However, I want to create the > > ButtonColumn & EditCommandColumn dynamically (i.e. > > during run-time). So I removes those 2 pieces of > ASP > > code (asp:ButtonColumn & asp:EditCommandColumn) > from > > the aspx, and in my VB code, I add this: > > > > Dim btnColumn As New ButtonColumn > > btnColumn.ButtonType = ButtonColumnType.LinkButton > > btnColumn.HeaderText = "Delete item" > > btnColumn.Text = "Delete" > > btnColumn.CommandName = "Delete" > > > > Dim editColumn As New EditCommandColumn > > editColumn.HeaderText = "Edit Item" > > editColumn.ButtonType = > ButtonColumnType.LinkButton > > editColumn.UpdateText = "Update" > > editColumn.CancelText = "Cancel" > > editColumn.EditText = "E" > > editColumn.ItemStyle.Wrap = False > > > > ItemsGrid.Columns.Add(btnColumn) > > ItemsGrid.Columns.Add(editColumn) > > > > At first, it displays the grid correctly, however, > > when I click on "Delete" or the "Edit" link > button, > > it > > never raises the event OnDeleteCommand nor > > OnEditCommand! > > > > Has anybody experienced this kind of problem as > > well? > > Thanks a lot! > > > > Adrian > > > > > > > > __________________________________ > > Do you Yahoo!? > > Read only the mail you want - Yahoo! Mail > SpamGuard. > > http://promotions.yahoo.com/new_mail > > > > > > > > Yahoo! Groups Sponsor > > ADVERTISEMENT > > click here > > > <http://us.ard.yahoo.com/SIG=129ap372f/M=295196.4901138.6071305.3001176/ > > > D=groups/S=1705006764:HM/EXP=1095932372/A=2128215/R=0/SIG=10se96mf6/*htt > > p:/companion.yahoo.com> > > > > > <http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=group > > s/S=:HM/A=2128215/rand=166831207> > > > > _____ > > > > Yahoo! Groups Links > > * To visit your group on the web, go to: > > > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > > > > * To unsubscribe from this group, send an > > email to: > > [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED] > > cribe> > > > > * Your use of Yahoo! Groups is subject to > > the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/> . > > > > > > [Non-text portions of this message have been > > removed] > > > > > > > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! > http://promotions.yahoo.com/new_mail > > > > Yahoo! Groups Sponsor > ADVERTISEMENT > click here > <http://us.ard.yahoo.com/SIG=129q0nmnh/M=298184.5285298.6392945.3001176/ > D=groups/S=1705006764:HM/EXP=1095953620/A=2319498/R=0/SIG=11thfntfp/*htt > p:/www.netflix.com/Default?mqso=60185352&partid=5285298> > > > <http://us.adserver.yahoo.com/l?M=298184.5285298.6392945.3001176/D=group > s/S=:HM/A=2319498/rand=405082706> > > _____ > > === message truncated === __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail Yahoo! Groups Sponsor ADVERTISEMENT ------------------------------------------------------------------------------ Yahoo! Groups Links a.. To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ b.. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
