テーブルのある aspx ページがあります。テーブルの各行は、データベース テーブル (場所を表す) の行を表します。
OnClick イベント (または別のイベント) にパラメーターを渡す方法が必要です。CommandArgument を使用できないのは、idPlace 文字列を知る必要があり、それがわからないからです。FORループでテーブルを構築します。
次のようなものが必要です:
<asp:ImageButton ID="ImageButton1"
runat="server"
ImageUrl="Maps.ico"
**CommandArgument = '<%=placesDataTable[0]%>'**
/>
テーブル内の場所 (行) ごとにマップへのリンクが存在するという主なアイデア - placeId を取得し、データベース内の別のテーブルから googleMap の座標を取得する別のページ。
私はそれに数時間取り組んでいますが、イライラしています。
ありがとう、ヒラ
コードの一部を次に示します。
<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>
私が望むのは、ユーザーが特定の行 (場所) をクリックすると、SPECIFIC placeId- を使用して C# コードの OnClick イベントに移動し、そこでデータベースに接続し、場所の座標を取得し、Responder.Rediret を取得することです。マップ上の場所を表示する別の aspx ページに移動します。placeIdだけが必要です...