Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ASP.net Datagrid QuestionASP.net Datagrid Question
Previous
 
Next
New Post
8/4/2007 2:47 PM
 

Hi,

I'm working on a module and have decided to use a datagrid.  In my datagrid I have to display a variable number of columns as the underlying data is a matrix that cross references weekends vs teams in a schedule type display.  I can get my table to render properly when autogenerate columns is on and I pass the table into it.  I can even get the formatting etc working properly.  My intial problem was that I wanted some of my dynamic column to have working link buttons and images in them.  

First attempt was that i would add a link button and my images on the databound event,  that worked, but it doesn't persist on postback becuase the controls are only added on databinding.  I then added the controls in the datagrids item created event.  This would make the first display of my grid databound without my controls.  Then when I would click another link button on the page it would refresh and not show the data, but show my empty controls added during the item created event.

The answer would of course be a template column.  I've used them before through asp.net and they work great, this is of course a different aproach when adding them through code.  After figuring out how to create the template column class, bind it to the template column and add that to my datagrid I tried my app.  It worked, but when I press one of the link buttons the dynamic columns disappear.

I then tried building my columns in the page_init event.  That works great but I can't run my sql query to get the underling data until I have a drop down list values.  If i try to get the value of that control in the page_init event it gives me a null reference exception.

I know that I have to add my columns in at a stage in which the datagrid's viewstate is not yet applied to the table but i cannot find any resources that help me.  I need my database query to be ran prior to binding my columns but I need the values from a drop down list before I can run my query.    What event/stage can I put my code in to ensure that the columns are created in the right order.

 

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0ASP.net Datagrid QuestionASP.net Datagrid Question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out