Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't select a GridView Control from Visual Studio when in an <asp:table>

I'm sure this is probably a really dumb thing I am overlooking. I can't seem to select/highlight any GridView controls in Visual Studio 2010 when they are located within an asp:table element. If I move the GridView outside of the asp:table element then I can highlight it and see the properties in the property window.

When the control is in the table element it doesn't display in the designer (but does when running the site) and does not appear in the properties window drop down. Please see screen shot. Any ideas? I've looked at just about every option in Visual Studio but can't seem to find one that would apply.

This isn't a coding issue as the grid itself works fine - that's why no code is posted here.

Any thoughts?

Edit - it won't let me post a screen shot so I'll post the link

https://i.sstatic.net/lfO86.jpg

like image 217
BigDaddyJay Avatar asked Jan 30 '26 20:01

BigDaddyJay


2 Answers

You can't access it because it becomes part of the tables controls collection, much like you can't directly access a TextBox in the column of a GridView.

You have two options:

  1. Use a regular HTML table instead
  2. Use the FindControl() method to access the GridView in code-behind

EDIT

For editing the control at design-time, it might be more efficient to go into the source view (markup) instead of dragging it in and out of the container. It will save you having to move it all the time, and you might find that it's faster than using the properties window; I know I find it much faster to edit the markup.

like image 54
James Johnson Avatar answered Feb 02 '26 11:02

James Johnson


welcome to VS2010... and every other VS :D

what you can do is go to your source code, scroll to the item you want and just click it's tag. it should show in the properties window on the right for you to edit.

like image 41
peroija Avatar answered Feb 02 '26 10:02

peroija



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!