Really having trouble with UI design using AJAX and Web Dev Express 2005. Designing systems for 25 years and finding the latest and greatest the biggest pain in the ass to figure out since JCL.

Anyway:

I have been trying to put controls such as the Gridview into a <DIV> instead it always positions itself all over the page in absolute placement. The control is bound and I cannot shrink the grid to fit the size of my <DIV> box either. I also had this problem with listbox and drop downs too. What am I missing?

Signed
The very dense developer

Do you know any CSS?


I haven't had too much experience with Microsoft's AJAX framework, but if you're dealing with div tags then you could resize those via CSS.

All you have to do is give the div tag an id or class(if you're going to use the same one more than onece). Something like this should work:

<div id="gridview">

asp grid control here.
</div>

Then create an external CSS file(either in vs or your editor of choice) and insert the following code into it:

#gridview{
height:100px;/*change this to get the your ideal height  in pixels*/
width:100px;/*change this to get the your ideal width in pixels*/
}

Save that as mainstyle.css into the directory your aspx page is in.

then in your aspx pages , insert this into the head tags:

<link href="mainstyle.css" rel="stylesheet" type="text/css" media="all" />

You can change the href to match the location of your CSS file as if it was regular hypertext link.

The above code should change the size of your div tag which should influence the size of your grid control.

Or you can insert CssClass="gridview" into your grid view control asp tag.

then change the external style sheet that you just made from above to .gridview not #gridview

Alternatively you can also insert an inline style such as style="width:100px; height:100px;" into your div tag. l

For example:

<div style="width:100px; height:100px;"></div>

This changes the size of the div without using an external stylesheet that I just written above.


Also, the official site for Microsoft's AJAX framework offers excellent video tutorials on the same thing:

http://asp.net/learn/ajax-videos/

Thank you very much. I was looking at third party controls but would prefer to stay within the framework and not introduce new dll's.

Well... you're still within the .NET framework if you take this approach-- you're just customizing the HTML you're putting on the page. That's a pretty standard thing to do...

This article has been dead for over six months. Start a new discussion instead.