Web API to pass values to the web page - asp.net

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.

Related

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.

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}" />

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.

jump link not working in asp.net iframe

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>

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).

Resources