Click here to Skip to main content
15,893,594 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: tiers Pin
Mike Ellison12-Oct-06 6:35
Mike Ellison12-Oct-06 6:35 
Questionproblem with asp.net2.0/sqlserver200 Pin
S.Bhushan12-Oct-06 5:14
S.Bhushan12-Oct-06 5:14 
AnswerRe: problem with asp.net2.0/sqlserver200 Pin
Mike Ellison12-Oct-06 6:37
Mike Ellison12-Oct-06 6:37 
QuestionCreate multilingual web pages very easily Pin
tnsenthil12-Oct-06 5:10
tnsenthil12-Oct-06 5:10 
Questionhow to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
steven_wong12-Oct-06 5:01
steven_wong12-Oct-06 5:01 
AnswerRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
Mike Ellison12-Oct-06 7:02
Mike Ellison12-Oct-06 7:02 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
miniThomas12-Oct-06 19:11
miniThomas12-Oct-06 19:11 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
Mike Ellison13-Oct-06 6:36
Mike Ellison13-Oct-06 6:36 
Hi Mini. The code worked as is for me... did you change the datasource or when the data is bound?

The one thing about the technique I demonstrated is that the data must be bound to the grid before the PreRender (or other event of choice) is triggered. If the data isn't bound, then there isn't a child Table control to inspect, and I'm guessing that's why you're getting an error referencing dg.Controls[0].

Another way to go about this, that is probably better anyway, is to use the ItemDataBound event of the DataGrid. Take a look at the event documentation for it on MSDN and you'll see an example of how it is used. It's very similar to the approach I showed here, except that you'll access a table row and its cells through the event args that are passed to the ItemDataBound event handler, rather than accessing the child Table control directly.

If there's interest, I might be able to work up an article on this fairly quickly.
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
steven_wong14-Oct-06 16:24
steven_wong14-Oct-06 16:24 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
Mike Ellison15-Oct-06 11:43
Mike Ellison15-Oct-06 11:43 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
steven_wong15-Oct-06 14:08
steven_wong15-Oct-06 14:08 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
miniThomas15-Oct-06 18:58
miniThomas15-Oct-06 18:58 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
Mike Ellison16-Oct-06 8:02
Mike Ellison16-Oct-06 8:02 
GeneralRe: how to fix datagrid column width/height when AutoGeneratedColumns is ture? Pin
Mike Ellison16-Oct-06 8:02
Mike Ellison16-Oct-06 8:02 
QuestionSorting Datagrid Pin
happyheartcs12-Oct-06 2:40
happyheartcs12-Oct-06 2:40 
AnswerRe: Sorting Datagrid Pin
varuni6512-Oct-06 3:04
varuni6512-Oct-06 3:04 
AnswerRe: Sorting Datagrid Pin
postmaster@programmingknowledge.com12-Oct-06 5:13
postmaster@programmingknowledge.com12-Oct-06 5:13 
AnswerRe: Sorting Datagrid Pin
Britney S. Morales12-Oct-06 9:38
Britney S. Morales12-Oct-06 9:38 
Questionhow to delete unuser email userid automatically after 24 hours Pin
dhatchu12-Oct-06 2:34
dhatchu12-Oct-06 2:34 
AnswerRe: how to delete unuser email userid automatically after 24 hours Pin
Vasudevan Deepak Kumar12-Oct-06 4:21
Vasudevan Deepak Kumar12-Oct-06 4:21 
QuestionDisplay OpenFileDialog On click event of ImageButton using ASP.NET & C# Pin
Soniya_k12-Oct-06 2:34
Soniya_k12-Oct-06 2:34 
AnswerRe: Display OpenFileDialog On click event of ImageButton using ASP.NET & C# Pin
Vasudevan Deepak Kumar12-Oct-06 4:22
Vasudevan Deepak Kumar12-Oct-06 4:22 
QuestionProblem : How to Extract The Zip file Pin
Amit Agarrwal12-Oct-06 1:28
Amit Agarrwal12-Oct-06 1:28 
AnswerRe: Problem : How to Extract The Zip file Pin
Vasudevan Deepak Kumar12-Oct-06 4:23
Vasudevan Deepak Kumar12-Oct-06 4:23 
GeneralRe: Problem : How to Extract The Zip file Pin
Amit Agarrwal12-Oct-06 19:00
Amit Agarrwal12-Oct-06 19:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.