bang head here Posted January 27, 2003 Posted January 27, 2003 So like everyone knows in classic ASP you can mix HTML and the VBScript. Is this not possible in .NET? I'm needing to create a table that has a header and there are rows created based on an integer. Before I would just wrte the first row (header) of the table and then loop through the int and create that many rows below. Well how can I replicate that in .NET? Would I need to create two functions let's say and call those somehow? I'm a bit lost on how much you can mix HTML and VB in .NET. Thanks. Quote
bang head here Posted January 27, 2003 Author Posted January 27, 2003 Also, can you use the DataGrid with form elements? Like if I wanted to read a table, put it into a datagrid but have some of the fields be a select box...is that possible? Or is the DataGrid just for displaying results? Quote
Moderators Robby Posted January 27, 2003 Moderators Posted January 27, 2003 You can easily use HTML table (tags).... Create and display a Label or Panel, and just do this... Label1.Text = "<table><tr><td>Something</td> .....etc..." Quote Visit...Bassic Software
bang head here Posted January 27, 2003 Author Posted January 27, 2003 Well what if I wanted to create drop downs populated from a database? All of the fields are either dropdowns or text boxes. I've been reading up on using code behind so do this, but is there an advantage to code behind for something like this? I'm in my second week of .Net, and this seems to be the last of the big issues I'm having. All I want to to is be able to write out a table with n rows and have the form elements populate correctly. The data population from the table will be the next thing, but first I'd like to be able just to create the correct amout of rows with one header. Thanks! Quote
Moderators Robby Posted January 27, 2003 Moderators Posted January 27, 2003 With the above example I use the Code-Behind method... You can populate an array with the data from a DB and then loop through the array to generate the <td> tags. For a dropdown you can use the same method or if you need to handle events, use a DropDownList (web control) and bind the data using a Dataset. Quote Visit...Bassic Software
aikeith Posted February 5, 2003 Posted February 5, 2003 You should use the .NET way (Code behind), but ASP.NET still supports the ever so familiar <% myFunction(Butt, Boots) %> or <% =myValue%> Difference is, if you want your functions then you have to define them and update something else on the page... The sample below should be how you would update a table with info from a database (does not show connection string, etc.) So, you really DONT want to mix html and vb MOST of the time. This also helps to encapsulate your data. So if you use a code behind and these methods, you could distribut your .aspx page and a .dll --- Then your code would be protected. ie: <script language="vb" runat="server"> Dim ds As New DataSet Dim dg As Datagrid dg.DataSource = ds dg.DataBind() </script> <html> <asp:dg runat="server"> </html> Quote
bungpeng Posted February 11, 2003 Posted February 11, 2003 It seem to be more complicated compare with classic ASP... In ASP.NET, we can either use code-behind or classic ASP method to program our ASP.NET application. Did anyone test the speed? For this example of 'bang head here', use code-behind is faster or non-code-behind? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.