Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView Bind to DataTable Session.. ItemStyle.Wrap?? 2

Status
Not open for further replies.

tqeonline

MIS
Oct 5, 2009
304
US
Hey Guys... I have a Gridview that is binding to a DataTable that I have stored in a session.

i have put this code:
Code:
        'sets all the columns to not Wrap
        For x = 0 To gvResults.Columns.Count - 1
            gvResults.Columns(x).ItemStyle.Wrap = False
        Next x

In every single option I can think of.
Right after the databind()...
gvResults_*Every single drop down item*

And nothing can make the rows on the gvResults table to not wrap.

I have tried doing
Code:
For X = 0 to 10
...

And everytime it comes back as an index error.

The Gridview is inside an UpdatePanel... is that why i can't grab it?
 
I echo mark's comments. presentation concerns should be handled by the client via CSS. try to avoid using the server control style properties. At most you can set the ClassName property which assigns the value(s) to the class attribute on the DOM. but avoid everything else, it actually makes it difficult to write clean, maintainable, understandable code.

one other side note. where the data comes from has nothing to do with how the data is presented. that's the beauty of separation of concerns.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks guys you lead me in the right direction!

Code:
.DataWebControlStyle td
{
  white-space: nowrap;
}

Then assign the Gridview to that CSS. Got it working perfectly.

Thanks for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top