Datagrid with dynamic columns does not fire SelectedIndexChanged
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
According to the results that I get back I must add more columns to the
This is a sample of how I am adding these colums:
templateColumn = New TemplateColumn
templateColumn.HeaderText = "Number"
templateColumn.SortExpression = "112"
templateItem = New columnTemplate
templateItem.ColumnName = "Number"
templateColumn.ItemTemplate = templateItem
AddHandler dgResults.SelectedIndexChanged, AddressOf
Once I bind the datagrid and get my result set back I see the datagrid
with all my values. Every field has a __doPostBack event associated to
it. If I understand correctly, ASP.NET automatically generates this
code and I cannot modify it.
If I click on one of the first 2 columns which were template columns in
the IDE, I see the Page_Load fire, then the datagrid's
SelectedIndexChanged followed by the Page_PreRender event. THis works
My problem is that if I click on one of the columns that I generated
dynamically The Page_Load will fire and then the Page_PreRender event.
The datagrid's SelectedIndexChanged does NOT fire.
I have tried the AddHandler to wire the SelectedIndexChanged event.
I am trying to understand why all of these are hotlinked but they are
not all behaving the same. I need to get the SelectedIndexChanged from
the dynamic columns.
|All times are GMT. The time now is 04:42 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.