I am populating a repeater on my asp.net web page (pop up) from a stored procedure call. I have a column where I need to build the hyperlink based on the values dynamically that calls an inquiry back to my original web form. However, the trouble I am having is that when I click on the link, I need to also retrieve some other data and insert this data into the viewstate.
The "GetListOfValues" function that I am calling obviously doesn't work the way I have this coded. Is there a way to accomplish this, and maybe even do it better than I am attempting to do it?
Here's my example:
Default.aspx
<asp:Repeater ID="rptReport" runat="server">
<HeaderTemplate>
<table>
<tr>
<td>Name</td>
<td>ID</td>
<td>Value1</td>
<td>Value2</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"Name") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"ID") %></td>
<td><%# DataBinder.Eval(Container.DataItem,"Value1") %></td>
<td><%# GetValueTwoLink(Eval("Name"),Eval("Value2") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
<tr>
<%--This area holds totals for columns--%>
</tr>
</table>
</FooterTemplate>
</asp:Repeater>
Default.aspx.cs
protected string GetValueTwoLink(object name, object value2)
{
ViewState["ListOfValues"] = datalayer.GetListOfValues(name, value2);
return string.Format(
"<a href=\"#\" onlick=\"window.opener.ViewValues('{0}')\">{1}</a>",
name,
Convert.ToInt32(value2).ToString("d"));
}
Any help would be appreciated!