Answered by:
Setting the Column Width for SPGridView in custom web part

Question
-
I have a custom web part which I am adding in SharePoint. This web part contains a SPGridView which has 4 columns. The same web part is added twice to the page but displays different data based on the web part properties.
But the column widths in both the web parts is not same. I tried using ItemStyle property to set the width of the columns but it is not working for me.
How can we set the width of the SPGridView columns programatically?
Babal Parihar
Monday, February 13, 2012 5:31 AM
Answers
-
the column width will depend on the data... well if not programmatically may be you can define the style attributes using CSS and then apply it
"T" | My blog updates | My Twitter | Our Products | Mail Me | LinkedIn | My Virtual Business Card
A THOUGHT ABOUT MY WORKPLACE :)- Proposed as answer by Varun Malhotra Monday, February 13, 2012 6:12 AM
- Marked as answer by Xue-Mei Chang-MSFT Monday, February 27, 2012 1:47 AM
Monday, February 13, 2012 5:51 AM -
Try setting the width of the columns in the ItemStyle.Width property (Template field, Bound field, etc) if you don't have a css in place. Or try the CSS property of the ItemStyle of that field.
- Edited by Simouna Monday, February 13, 2012 6:41 AM
- Marked as answer by Xue-Mei Chang-MSFT Monday, February 27, 2012 1:47 AM
Monday, February 13, 2012 6:39 AM
All replies
-
the column width will depend on the data... well if not programmatically may be you can define the style attributes using CSS and then apply it
"T" | My blog updates | My Twitter | Our Products | Mail Me | LinkedIn | My Virtual Business Card
A THOUGHT ABOUT MY WORKPLACE :)- Proposed as answer by Varun Malhotra Monday, February 13, 2012 6:12 AM
- Marked as answer by Xue-Mei Chang-MSFT Monday, February 27, 2012 1:47 AM
Monday, February 13, 2012 5:51 AM -
Try setting the width of the columns in the ItemStyle.Width property (Template field, Bound field, etc) if you don't have a css in place. Or try the CSS property of the ItemStyle of that field.
- Edited by Simouna Monday, February 13, 2012 6:41 AM
- Marked as answer by Xue-Mei Chang-MSFT Monday, February 27, 2012 1:47 AM
Monday, February 13, 2012 6:39 AM