473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

dynamic datagrid

I am using a dynamic datagrid and want to add the "delete" command,but no
matter what I try I cannot get it to work. This is what I have:

ButtonColumn del = new ButtonColumn();
del.Text = "deleteTest";
del.ButtonType = ButtonColumnType.LinkButton;
del.CommandName = "Delete";
DG.Columns.Add(del);
DG.ItemDataBound += new
System.Web.UI.WebControls.DataGridItemEventHandler (this.dgAssDealers_ItemDataBound);
DG.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.dgAssDealers_DeleteCommand);
The ItemDataBound works fine, but not the Delete. The button shows up in the
grid, but it's not "linked" , in other words, there's nothing to click. Has
anyone got any idea how to do this? I've been banging my head all weekend on
this and just cannot get it to work :(
Oct 29 '07 #1
1 1069
On Oct 29, 3:15 pm, ann <a...@discussions.microsoft.comwrote:
I am using a dynamic datagrid and want to add the "delete" command,but no
matter what I try I cannot get it to work. This is what I have:

ButtonColumn del = new ButtonColumn();
del.Text = "deleteTest";
del.ButtonType = ButtonColumnType.LinkButton;
del.CommandName = "Delete";
DG.Columns.Add(del);

DG.ItemDataBound += new
System.Web.UI.WebControls.DataGridItemEventHandler (this.dgAssDealers_ItemDa*taBound);
DG.DeleteCommand += new
System.Web.UI.WebControls.DataGridCommandEventHand ler(this.dgAssDealers_Del*eteCommand);

The ItemDataBound works fine, but not the Delete. The button shows up in the
grid, but it's not "linked" , in other words, there's nothing to click. Has
anyone got any idea how to do this? I've been banging my head all weekendon
this and just cannot get it to work :(
it looks like you are using the generic command event handler with the
key word delete. try using the event handler for delete or changing
your commandName to deleteme or something like that.

Oct 30 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: JP011 | last post by:
Hello I have hit a major road block when it comes to building my dynamic datagrid. To make a long story short I need a dynamic datagrid because my connection string could change and I need the...
1
by: Shourie | last post by:
I've noticed that none of the child controls events are firing for the first time from the dynamic user control. Here is the event cycle. 1) MainPage_load 2) User control1_Load user clicks a...
0
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a...
0
by: tafpin | last post by:
I have an application with a datagrid. In the IDE I have 2 template columns. The first has an image button and the second contains a link button. According to the results that I get back I must...
1
by: benoit | last post by:
Hi, I created a Dynamic Datagrid and i added an EditCommandColumn to it. Works fine, but my Editcommand eventhandler seems to have a problem with PostBack This is my code private DataGrid...
7
by: CanoeGuy | last post by:
I have been trying for the last two weeks to display a dynamic DataGrid. The data that I'm pulling from a SQL Server DB will have whole columns that will be either NULL or 0. I want to display...
4
by: tg | last post by:
Visual Studio 2003 My problem is that I am dynamically creating a datagrid on pageload. The datagrid is completely dynamic as it is based on the number of columns returned from a recordset. The...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
0
by: KA NMC | last post by:
I have a dataGrid that is populated by SQL table. The Datagrid has two dynamic columns - that I created to for calculations. I want to sort the grid on frmload by one of the dynamic columns is that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.