Can you use a classic asp table in asp.net? - asp.net

I am unsure if you can still use a table in asp.net and have the fields filled in via a dataset.
This was done in the old asp.
<table border="0" cellpadding="0" cellspacing="0" id="Table1">
<tr>
<td class="test1"><strong>Person Number:</strong></td>
<td class="test2"><%=DataSetvalue("PNum")%></td>
</tr>
<tr>

Yes! you can do it.
Have a look on following links
http://www.shiningstar.net/blog/tables.aspx
http://www.w3schools.com/aspnet/control_table.asp

Related

Web API to pass values to the web page

I have an web page to which I dont have access to the source code. I will need to create an API that will pass auto generated values to the Text box on the page. As I dont have access to the source code of the page, not sure how I will be able to pass the auto generated values through the API.
When I right click I get the source of the field like below
<div class="OneColTable">
<table class="DataInputTable">
<tr>
<td colspan="2"><h3>Enter Project Information</h3><br/></td>
</tr>
<tr>
<tr>
<td class="label">Project name:</td>
<td><input type="text" name="project.name" value="" class="RequiredField"></td>
</tr>
</tr>
I have create an WEb API before but not sure how to approach this scenario. Any help is greatly appreciated.

HTML5 how to make table borders even?

I've got an assignment from college to do and I've one question.
This is what I am supposed to do:
And the blue border is even. On my site:
It is not. Is there any CSS to make them even ?
<table>
<tr>
<th>Module Description</th>
</tr>
<tr>
<td>The successful learner will, through the use of a realistic commercial scenario, take a project through the software development lifecycle. They must take their project from problem statement through the significant phases of a software project. </td>
</tr>
<tr>
<th>Learning Outcomes</th>
</tr>
<tr>
<td>On a successful completion of this module the learner will/should be able to do...</td>
</tr>
</table>
I didn't know about width="100%" attribute. This was the answer for my question. Sorry for this missleading question :D

Change value of custom table data in a repeater

I want to create a page where the user can modify my custom table data. I currently have a Custom table data source and a Basic repeater. The Transformation looks like this:
<table border="1" style="border-collapse: collapse" width="200">
<tr>
<th>Node ID:</th>
<td><%# Eval("helpful_nodeID") %></td>
</tr>
<tr>
<th>Culture Code:</th>
<td><%# Eval("helpful_cultureCode") %></td>
</tr>
<tr>
<th>Not Helpful:</th>
<td><%# Eval("helpful_no") %></td>
</tr>
<tr>
<th>Helpful:</th>
<td><%# Eval("helpful_yes") %></td>
</tr>
<tr>
<button>Clear rating</button>
</tr>
</table>
So I would like my button to have the opposite effect of Eval, and force the value of 0 for "helpful_no" and "helpful_yes".
Is there an easy way, such as <% Set ("helpful_yes") = 0 %> for example?
Unfortunately, there is no such easy thing as an Set method which would store the data. Neither in ASP.NET nor in Kentico. The best way is probably creating your own user control/ webpart to do it.
EDIT:
Following materials may be useful.
How to create new webpart
Every installation of Kentico also contains API examples section. If you are on Kentico 8, just open application list, type API examples, open it. There under development section you'll find custom tables examples which shows how to do basic manipulation with custom table objects.

Load data into a UserControl as control properties or in control code behind?

I'm building a UserControl that will repeat on the page a variable number of times. I'm trying to determine what the most efficient way to handle the data I will be loading into the Control. For the sake of simplicity, lets say it will be structured something like this:
<table>
<tr>
<td>Header Item</td>
</tr>
<tr>
<td>Body Item n</td>
</tr>
<tr>
<td>Body Item n+1</td>
</tr>
<tr>
<td>Body Item n+2</td>
</tr>
<tr>
<td>etc.</td>
</tr>
<tr>
<td>Footer Item</td>
</tr>
</table>
All of the data that will be loaded into this Control will come from a SQL Query. The Body items will be changing on every iteration of the control, but the Header and Footer items will be the same, and that is where I am trying to decide between a couple of options I can see.
Build the query into the code behind of the control itself and repeat it for every iteration of the control, or:
Query the data from the .aspx.cs page where the control will be used and deliver them as properties when the control is created.
?
Option 1 seems very inefficient. If we were talking about only two items, then I might just be inclined to accept the inefficiency, but we're talking about a lot more.
Option 2 seems plausible, but I have no idea if that is actually any better than option 1.
Thoughts? Other options?
Use a Repeater control
Have a look here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater(v=vs.80).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
<asp:Repeater runat="server">
<HeaderTemplate>
<table>
<tr>
<td>Header Item</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>Body Item <%# Eval("Number") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<td>Footer Item</td>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>

Visual Web Developer 2010 suddenly making tables

I have a navigation menu defined in visual web developer 2010 express using a bunch of tags. This worked as expected until a few days ago, when I must have accidentally changed something. I noticed the styles were no longer getting displayed on the menu, so I examined my master page and compared it to a default master page.
My page generates this for a menu item:
<table id="ctl00_NavigationMenu" class="menu ctl00_NavigationMenu_2" cellpadding="0" cellspacing="0" border="0">
<tr>
<td onmouseover="Menu_HoverStatic(this)" onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(event)" id="ctl00_NavigationMenun0"><table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="white-space:nowrap;"><a class="ctl00_NavigationMenu_1" href="Default.aspx">Home</a></td>
</tr>
</table></td>
</tr>
</table>
Whereas the default master page generates this:
<li><a class="level1" href="Default.aspx">Home</a></li><li><a class="level1" href="About.aspx">About</a></li>
The problem seems to be that a table is being generated from the MenuItem tag instead of a list. How did I do this and how do I fix it?
Just shot in the dark, but did you make any changes to your framework version? When upgrading a project to 4.0, the following line gets added to your web.config which changes the way some tags are rendered:
<pages controlRenderingCompatibilityVersion="3.5" ...
If it's there, you might try removing it...

Resources