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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp:Table Control

Status
Not open for further replies.

kyledunn

Programmer
Jan 2, 2001
145
0
0
US
I am inserting an asp:RadioButton control into an asp:Table control using Visual Studio.NET. On the design tab it seems necessary to insert the asp:RadioButton control onto the page outside of the table and then switch to the HTML tab to move the asp:RadioButton tag into the asp:TableCell tag to place the RadioButton in the table. Anyone know of a way to put a RadioButton control into a Table control in design mode?

Kyle
 
When you are the only guy in the forum it seems best to help yourself. I figured out that I should be using a standard html table for formatting and inserting the asp:RadioButton controls into the standard html table.
 
First things first, I would suggest not using the design view. Use the HTML view and place the radio within the table-tr-td you wish.

I would also suggest making your view a control instead of just using the aspx as you would in classic asp. My aspx's and ascx's have no script code. Only inside the 'code behind'.

No question this is a learning curve product but we'll get there. :)

B

 
Thanks for your response. I really appreciate another ASP.NET developers insight.

I am using design view to initially add web form server side controls to a web form. The HTML view does not give me this option.

My mistake was attempting to insert a web form server side RadioButton control inside a web form server side Table control. In design mode it would not allow me to insert one server side control inside another server side control so I went to HTML view and moved the RadioControl tag between the server side TableCell tags. It appeared to work until I removed the absolute coordinates of the RadioButtons and then the control threw an error. Once I used a standard HTML table I could insert server side RadioButton controls into the HTML table cells using relative positioning and the server side RadioButtons now move relative to the position of the table. It was stupid to choose a server side table control when it was not needed, just part of jumping into this new environment.

The RadioButtonList control is a nice option but I needed a single group of radio buttons that spanned two physically separate tables. I needed the server side control because the radio buttons are generating SQL database updates.

I have nothing but HTML in my aspx file. I'm using the code behind aspx.cs file for all script. I want to use the ascx user control approach but was waiting until I had code that warrented reuse. If my HTML and C# code are separated with the aspx and aspx.cs pages and the code is not going to be reused, do you see an advantage of creating a user control with this code?

And when we get there I think it will be better than ever. :>)

Thanks again, Kyle
 
Something I've discovered using controls. At this stage in the beta, usage is not clear and I'm sure is still up to minor changes. We are in the middle of developing a large application using the platform and I without question have been pounding my head agains a wall for a while. :)

>I needed a single group of radio buttons that spanned two physically separate tables.

This is the exact situation you would use a control. Make the control have the radios you want or even dynamically create the amount of radios you want. Then use the control in your aspx as individual copies, just name (id) them differently.

Reuse is the grand idea but realistically, modularity is the true advantage. Example, you can change the control itself and everywhere it's used will automatically be updated as well. This is a large scale method but good programming practice in general. We write wrapper classes as a middle layer to our databases. The will only be used once but the benefit is if we make changes to the data structure, we only have to change the wrapper class (in most cases) and the change is automatically implemented system wide.

You're lucky getting to use CSharp, I have an entire team (sub-contractors) that only know VB so I'm stuck writing in VB and truly don't care for it. I stopped using the language a while ago and forced to relearn it and the .net version when I'd rather do CSharp because of the C syntax style that is so natural to object oriented development.

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top