I have a Web Form with a TreeView and a Gridview that I would like to put one beside the other.
So I've used an HTML Table with just two cells:
in the first cell I've put the TreeView and in the second cell (beside the first) the GridView.
While I can set the size of the GridView at design time (Visual Studio Express 2015 Web Edition), the GridView is "resized" at runtime according with the number of rows that I assign for a max of 20 rows (then it begins the paging).
The problem is that when the GridView displays less than 20 rows, the size is smaller than the TreeView and it is vertically aligned to the middle of the cell, but this happens only at runtime.
If I check the page inside the editor (design page) the GridView is "top aligned", that is what I want, but when I open the page at runtime the GridView is "vertically middle aligned".
How can I align it always on the top of the table cell (at runtime)?
I hope you could post your code, it is hard to think the issue you are facing through your description. This will better help you solve your problem!
Best Regards,
Eric Du
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
I think I found myself the solution while watching at the posted code.
There was a "</td" not closed after "</asp:GridView>", as soon as I "closed" it the GridView moved to the top !
Sorry....I'm still learning with Web Programming.
I just wonder why it worked in the "design page" of the Visual Studio.
Thank you.
According to your description, I have tested your code, also I tested the html tag and server tag. I found if html tag isn't complete, it will show normally in design view.
when you run it, it need compile in IIS, compile fail, so will cause this issue.
if the sever control is not complete, it will show error in design view.
I think this phenomenon is related to the principle of the VS running.
Best Regards,
Eric Du
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
20 Posts
Aligning to top a Gridview inside a cell of a table
Mar 16, 2017 05:05 PM|washburn_it|LINK
Hi,
I have a Web Form with a TreeView and a Gridview that I would like to put one beside the other.
So I've used an HTML Table with just two cells:
in the first cell I've put the TreeView and in the second cell (beside the first) the GridView.
While I can set the size of the GridView at design time (Visual Studio Express 2015 Web Edition), the GridView is "resized" at runtime according with the number of rows that I assign for a max of 20 rows (then it begins the paging).
The problem is that when the GridView displays less than 20 rows, the size is smaller than the TreeView and it is vertically aligned to the middle of the cell, but this happens only at runtime.
If I check the page inside the editor (design page) the GridView is "top aligned", that is what I want, but when I open the page at runtime the GridView is "vertically middle aligned".
How can I align it always on the top of the table cell (at runtime)?
Thank you, regards.
Roberto
Contributor
6730 Points
2715 Posts
Re: Aligning to top a Gridview inside a cell of a table
Mar 17, 2017 02:50 AM|Eric Du|LINK
Hi washburn_it,
I hope you could post your code, it is hard to think the issue you are facing through your description. This will better help you solve your problem!
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
20 Posts
Re: Aligning to top a Gridview inside a cell of a table
Mar 17, 2017 07:36 AM|washburn_it|LINK
Hi Eric,
this is the code of the page:
The CSS class "TableTopAlign" is the following:
Let me know if you need more.
Thank you, regards.
Roberto
Member
3 Points
20 Posts
Re: Aligning to top a Gridview inside a cell of a table
Mar 17, 2017 07:45 AM|washburn_it|LINK
I think I found myself the solution while watching at the posted code.
There was a "</td" not closed after "</asp:GridView>", as soon as I "closed" it the GridView moved to the top !
Sorry....I'm still learning with Web Programming.
I just wonder why it worked in the "design page" of the Visual Studio.
Thank you.
Roberto
Contributor
6730 Points
2715 Posts
Re: Aligning to top a Gridview inside a cell of a table
Mar 20, 2017 05:59 AM|Eric Du|LINK
Hi washburn_it,
According to your description, I have tested your code, also I tested the html tag and server tag. I found if html tag isn't complete, it will show normally in design view.
when you run it, it need compile in IIS, compile fail, so will cause this issue.
if the sever control is not complete, it will show error in design view.
I think this phenomenon is related to the principle of the VS running.
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
3 Points
20 Posts
Re: Aligning to top a Gridview inside a cell of a table
Mar 21, 2017 09:18 AM|washburn_it|LINK
Hi Eric,
thanks for your confirm.
Regards,
Roberto