jump link not working in asp.net iframe - asp.net

I am using the iframe in asp.net page.Page name is Home.aspx and iframe id name is frame1. I frame have some html design with more header. I want to search the header using quick link.But it's working fine in HTML page not in asp.net page. Please help me to do this..
My code is here..
<tr>
<td>
1. Employment Application
</td>
<td>
2. Transfer and Reassignment
</td>
<td>
3. Non-Discrimination
</td>
</tr>

As Billy Moat said, the problem is likely that you are using spaces in your href attributes for the links. This is not allowed, so you should change your hrefs and the IDs of the elements that they are referencing to not include spaces:
<tr>
<td>
1. Employment Application
</td>
<td>
2. Transfer and Reassignment
</td>
<td>
3. Non-Discrimination
</td>
</tr>

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.

Editable fields in Spring MVC

I'm a newbie to Spring MVC. Here's my question.
I have a input view where a user can input a name and a text, which will then be displayed like this:
<tr>
<td>Name: </td>
<td>${product.name}</td>
</tr>
<tr>
<td>Text: </td>
<td>${product.text}</td>
</tr>
How can I make the two fields editable for the user? I'd like to place a link or so next to each field, that the user can use for editing entries.
Furthmore, I'd like to link the request to the same page as the input page/form, how can I distinguish the two cases in my controller? I'm using SimpleFormController...
You can use a <a href tag as follows:
${product.text}
Therefore, in your example above, you could use the following:
<tr>
<td>Name: </td>
<td>${product.name}</td>
</tr>
<tr>
<td>Text: </td>
<td>${product.text}</td>
</tr>
Your edit page link urls will have to be the correct link to that edit page.
Alternative:
However, another way to make the fields editable is to use the spring <form> tags as below:
<form:input path="name" placeholder="${product.name}" />
<form:input path="text" placeholder="${product.text}" />

How to parse html table using xml?

I'm having an html table of the format
<table>
<th>
<td> td1 </td>
<td> td2 </td>
<td> td3 </td>
<td> td4 </td>
<td> td5 </td>
<td> td6 </td>
<td> td7 </td>
<td> td8 </td>
<td> td9 </td>
<td> td10 <td>
</th>
</table>
I need to parse through the cells in each row within the table body. I looped through the row using a javascript and inorder to save the html content i'm using webmethod( because on saving, my page will reload and i will lose my html table, to avoid that i stored it on a session using webmethod and this too happens within my javascript call) . The issue is my client side script is getting skipped at times and i'm not able to save my html content. So i thought of to send the html content as a whole in one script call and do the parsing in server-side.
Now, i need to know how to parse it from server-side. Can some-body help me to parse it using xml?
I think you should try HTML Agility Pack
from CodePlex
What is exactly the Html Agility Pack (HAP)?
This is an agile HTML parser that builds a read/write DOM and supports
plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor
XSLT to use it, don't worry...). It is a .NET code library that allows
you to parse "out of the web" HTML files. The parser is very tolerant
with "real world" malformed HTML. The object model is very similar to
what proposes System.Xml, but for HTML documents (or streams).

Localization html static text [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
asp.net globalization difference in inline tags
I read on MSDN about localization of static text and Localize control but I still don't understand: how should I localize for example a html table's static text?
<table>
<tr>
<td>
<%=Resources.Resource1.String1 %>
</td>
</tr>
<tr>
<td>
<%=Resources.Resource1.String2 %>
</td>
</tr>
</table>
or
<table>
<tr>
<td>
<asp:Localize ID="Column1" runat="server" Text="<%$ Resources: Resource1, String1 %>" />
</td>
</tr>
<tr>
<td>
<asp:Localize ID="Column2" runat="server" Text="<%$ Resources: Resource1, String2 %>" />
</td>
</tr>
</table>
The first is obviously is more readable and I don't need to change translations on runtime. Maybe it has some disadvantages vs second? I'm sorry for my stupid question but I want to be sure that way which I'll select will be more preferable and maintainable.
The examples you showed do not really make any difference. The first one will be easier to code - you will see IntelliSense (code completion) hint.
Personally I prefer Implicit Localization for it will give you defaults and I feel the code is less cluttered:
<table>
<tr>
<td>
<asp:Localize ID="Column1" runat="server" meta:resourcekey="Column2" Text="Column 1 name" />
</td>
</tr>
<tr>
<td>
<asp:Localize ID="Column2" runat="server" meta:resourcekey="Column1" Text="Column 2 name" />
</td>
</tr>
</table>
Also, I find App_LocalResources to be a better way for Localizing Asp.Net applications - you would need to split your translation into several .resx files, which might be just easier to maintain in large code base (for example it would be easier to use Translation Memory software; it should cost less).
For more information on Implicit Localization, see my previous answer.
The second one will give you a Control whose ID you can reference from code to change on the fly. The first one does not have this ability. For example:
if (condition)
Column1.Text += " - 123";
else
Column1.Text += " - 456";

Form Post Values using plain html controls in ASP.NET web forms

I have a simple form with some plain html input like bellow using ASP.NET Web Forms (not MVC)
<table id="tbl_SchoolDetails">
<tbody id="tbody_SchoolDetails">
<tr>
<td>
School Name
</td>
<td>
<input id="SchoolDetails_SchoolName" type="text" value="<%= ViewModel.School.Name %>" />
</td>
</tr>
<tr>
<td>
Head Teacher
</td>
<td>
<input id="SchoolDetails_HeadTeacher_Name" type="text" value="<%= ViewModel.School.HeadTeacher.Name %>" />
</td>
</tr>
<tr>
<td>
Head Teacher Email
</td>
<td>
<input id="SchoolDetails_HeadTeacher_Email" type="text" value="<%= ViewModel.School.HeadTeacher.Email %>" />
</td>
</tr>
<tr>
<td>
Regent/Placement Contact
</td>
<td>
<input id="SchoolDetails_Regent_Name" type="text" value="<%= ViewModel.School.Regent.Name %>" />
</td>
</tr>
</tbody>
</table>
When I do a post back to the server the values of the text boxes are not contained in the Request.Form element. Is there some reason for this that I am missing. I am reluctant to use asp.net controls as the page is later going to require a fair amount of javascript for changing the ui and other stuff.
I know I could easily do this with MVC but unfortunatly a change to this is not an option at this time.
Cheers
Colin G
Give the input both an id and a name and see if that doesn't solve your problem.
<input id="SchoolDetails_SchoolName"
name="SchoolDetails_SchoolName"
type="text"
value="<%= ViewModel.School.Name %>" />
The id property only identifies the tag within the DOM. The name property allows the tag to be posted back as part of a form. An ASP.NET control, or an HTML element with runat=server, automatically gets both the name and id properties assigned.
HTML elements are not part of the ASP.NET lifecycle. An easy way to start would be to add the runat="server" attribute to your INPUT elements.
#tvanfosson Cheers that worked just as I wanted.
#Bullins I really didn't want to use runat="server" as it causes the ID's of the controls to end up like ctl00_ContentPlaceHolder1_ctl00_SchoolDetails_Address_Postcode which makes it difficult to achieve what i am looking for.
#Colin Use ClientIDMode="Static" attribute and your server-side element name will remain the same on the client side even when you have runat="server" on the element. Hope this helps

Resources