Velocity Reviews

Velocity Reviews (
-   ASP .Net Datagrid Control (
-   -   ItemCommand on Dynamically built DataGrid not firing (

RCorona 12-21-2004 06:21 PM

ItemCommand on Dynamically built DataGrid not firing
I have a page on which I build one to many grids in a for loop depending on
the results of a sql query. Within each row of each grid I add a link button
to get details of that record. When you click on the button the post back
occurs but the item command does not fire. See the example of the code below.

Any help would be apprciated, thanks.

DataGrid dg = new DataGrid();

dg.EnableViewState = true;
dg.ItemCommand += new DataGridCommandEventHandler(dg_ItemCommand);
dg.AutoGenerateColumns = false;

BoundColumn dcPrgId = new BoundColumn();
dcPrgId.DataField = "ProgramId";
dcPrgId.Visible = false;
dcPrgId.ReadOnly = true;

TemplateColumn dcPayment = new TemplateColumn();
dcPayment.HeaderText = "Monthly Payment";
dcPayment.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
dcPayment.ItemTemplate = new FormatedItemTemplate("Payment",
dcPayment.ItemStyle.Width = new Unit("120px");
dcPayment.ItemStyle.HorizontalAlign = HorizontalAlign.Right;

ButtonColumn btnClosingCosts = new ButtonColumn();
btnClosingCosts.HeaderText = "Costs";
btnClosingCosts.HeaderStyle.HorizontalAlign =
btnClosingCosts.ButtonType = ButtonColumnType.LinkButton;
btnClosingCosts.Text = "View Details";
btnClosingCosts.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
btnClosingCosts.CommandName = "Costs";

dg.DataSource = vRates;


All times are GMT. The time now is 09:06 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.