I have an aspx page with a table. Each row in the table represents a row of data base table (which represents a place).
I need a way to pass to OnClick event (or another event) a parameter. I can't use the CommandArgument becouse then I will need to know the idPlace string and I just don't know it. I buld the table with FOR loop.
I need something like:
<asp:ImageButton ID="ImageButton1"
runat="server"
ImageUrl="Maps.ico"
**CommandArgument = '<%=placesDataTable[0]%>'**
/>
The main idea that for each place (row) in the table there would be a link to map- a different page which would get the placeId and get the coordinates of the googleMap from another table in data base.
I'm working on it a couple of hours and it's frustrating.
Thanks, Hila
Here is some parts from the code:
<body dir="rtl">
<form id="form1" runat="server" style="background-color:Fuchsia">
<!-- Here I will display all the results:-->
<p style="font-style:italic">Here are the results:</p>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<%
System.Data.DataTable placesDataTable = (System.Data.DataTable)Session["PlacesDataTable"]; // The table of all the places from the dataBase.
System.Data.DataRow rowOfPlace;
for (int i = 0; i < placesDataTable.Rows.Count; i++)
{
<tr>
<%
for (int j = 1; j < placesDataTable.Columns.Count; j++)
{%>
<td>
<% Response.Write(rowOfPlace[j].ToString()); %>
</td>
<%
} // end FOR LOOP over the columns
// insert MAP column content:
%>
<td>
<asp:ImageButton ID="ImageButton1"
runat="server"
ImageUrl="Maps.ico"
CommandArgument = '<%placesDataTable[i]%>'
/>
</td>
</tr>
<%
}
%>
</table>
</form>
</body>
What I want is that when user clicks spesific row (place) I will go to OnClick event IN C# code with the SPECIFIC placeId- and there I'll connect to the data-base, get the coordinates of the place, and Respondr.Rediret to another aspx page- which displays the place on the map. I just need the placeId...