Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datagrid with dynamic columns does not fire SelectedIndexChanged

Reply
Thread Tools

Datagrid with dynamic columns does not fire SelectedIndexChanged

 
 
tafpin@gmail.com
Guest
Posts: n/a
 
      06-08-2005
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 add more columns to the
datagrid.

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
dgResults.Columns.Add(templateColumn)
CheckSortHeader(templateColumn)

AddHandler dgResults.SelectedIndexChanged, AddressOf
dgResults_SelectedIndexChanged

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
fine.

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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
selectedIndexChanged event does not fire in drop down list akhzar ASP .Net 1 03-06-2009 11:26 AM
SelectedIndexChanged event does not fire Jim ASP .Net Web Controls 3 03-08-2005 07:18 PM
SelectedIndexChanged event does not fire? Jim ASP .Net 3 03-08-2005 05:46 AM
Datagrid Dynamic Columns Postback and SelectedIndexChanged problems George ASP .Net Datagrid Control 1 01-22-2004 04:49 PM
Datagrid SelectedIndexChanged Does Not Fire Brad ASP .Net Web Controls 0 11-25-2003 03:58 PM



Advertisments