HTML5 how to make table borders even? - css

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

Related

Long aspx file gets hard to read - is there a way to simplify

My aspx file has lot's of components and has become difficult to work with when eg. adding new items because I can't see the start and end tags of where the new control must go (especially when adding containers).
I was wondering if there is a way to arrange the code with some kind of placeholder (all within the same file is fine) - something along the lines of the mockup below?
<abc:container>
<abc:pages>
<abc:page>
[Page1CodeGoesHere]
</abc:page>
<abc:page>
[Page2CodeGoesHere]
</abc:page>
</abc:pages>
</abc:container>
<Page1CodeGoesHere>
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
</Page1CodeGoesHere>
<Page2CodeGoesHere>
<table>
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
</tr>
</table>
</Page2CodeGoesHere>
Use ASP.NET User Controls. It allow you to use code from separate files.
It seems you are looking for code-folding a-la #region support.
If yes, then Visual Studio 2013 Update 4 added support for #regions in HTML editor. You would use it like this:
<!-- #region Page1Code -->
..
<!-- #endregion -->
This will allow you to collapse-expand the regions as convenient to you.
Ref: http://blogs.msdn.com/b/webdev/archive/2014/10/16/announcing-new-web-features-in-visual-studio-2013-update-4-rc.aspx
Note 1:
This was voted against for in VS 2015, but was declined. So, #region support for HTML editor is here to stay it seems. Ref: https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/6571662-do-not-introduce-the-curse-of-regions-to-html
Note 2:
Nothing beats modular approach. Keep your pages small, clean and simple.

Better way of showing images from a model in razor

EDIT: it was the #ViewBag.Persona(item.IDPersona) part the problem.
In a view I iterate over a collection of models, each model has an url that corresponds to an image in the server. I want to display in a table every model with its image. So I did something like this:
<table class="tbody">
<tr class="th">
<th>ID
</th>
<th>Person
</th>
<th>Image
</th>
</tr>
#foreach (var item in Model.Entity)
{
<tr>
<td>
#Html.ActionLink(item.IDPersona.ToString(), "Edit", "Persona", new{Id = item.IDPersona}, null)
</td>
<td>
#ViewBag.Persona(item.IDPersona)
</td>
<td>
<img src="/img/#item.ImageName" height="100" width="100" />
</td>
</tr>
}
</table>
But the page can take up to 13 seconds to load. I imagine that the reason is because I am loading one image at a time instead of loading multiple images simultaneously.
Is there a way to improve the loading time? Maybe "delaying" the load of the image until the model have been iterated entirely, is this possible?
Looking at your code, and going off of the details in your comments, I don't think it's the images causing the issue. If it's simply pulling the images off of the local file system it's not likely that they'd be the cause of the slowness.

ASP:PlaceHolder - can't find code that's generating its contents

I need to update a bit of text that's being rendered on a .aspx page. I've searched the source and DB tables, views, and stored procedures, and can't find it.
The bit of code that's generating the text looks like this:
<asp:PlaceHolder id="teamMemberTable" runat="server" />
I searched and couldn't find any references to teamMemberTable anywhere else in the code. Is it possible that the code generating that bit has been compiled into binary and doesn't exist in plaintext anymore?
Here is an example of the outputted html:
<span id="ctl00_rightContent_Repeater1_ctl01_Literal1" class="teamListName">
Team Number One
</span>
<table>
<tr>
<td class="teamListMember">Team Captian</td>
<td class="teamListPlayer">Jane Doe</td>
<td class="teamListStatus teamListStatusPaid">Paid</td>
</tr>
<tr>
<td class="teamListMember">Player 2</td>
<td class="teamListPlayer">John Q. Public</td>
<td class="teamListStatus teamListStatusNotPaid">Not Paid</td>
</tr>
</table>
Yes, it is possible that the code is in an assembly that has already been compiled and is not in plaintext. One option is to run a tool such as .NET Reflector or ILSpy and decompiling all the assemblies in the app and searching through the decompiled code to locate any references to "teamMemberTable".
Another possibility is that the control is being referenced by index instead of by name. For example, if the PlaceHolder control is in the page, it could be referenced as Page.Controls[5] and so you'd never see the name in the source code.

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>

Typing in a IFrame with Selenium IDE

I'd like to type something in a IFrame with Selenium IDE but I don't know how to do this.
Thanks a lot!
You have to select the iframe and then type
selenium.selectFrame("css=iframe.widget[<a_css_identifier>]");
selenium.type(<your_object_or_text_box>, <typed_content>);
The statements are in java, but you should be able to find selectFrame and type in the IDE.
You can use the Selenium IDE command 'selectFrame' to focus within an iframe. Use the Target field to enter the iframe id.
Try
<tr>
<td>selectFrame</td>
<td>edit</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=//html/body</td>
<td>my text</td>
</tr>

Resources