我有一个Repeater
我将一些数据绑定到它。现在我的问题是如何从javascript
. 我的代码如下;
代码隐藏
protected void Page_Load(object sender, EventArgs e)
{
// bool boolfound = false;
string connstring = String.Format("Server=localhost; Port=5432; User Id=postgres; Password=database; Database=valletta;");
using (NpgsqlConnection conn = new NpgsqlConnection(connstring))
{
try
{
conn.Open();
NpgsqlCommand cmd = new NpgsqlCommand("select get_points('temp_intersect', 'point','id',17339)", conn);
NpgsqlDataReader dr = cmd.ExecuteReader();
currentpoint.DataSource = dr;
currentpoint.DataBind();
}
catch (Exception)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "$(document).ready(function(){alert('problem with connection')});", true);
}
}
}
ASP
<asp:Repeater ID="currentpoint" runat="server">
<ItemTemplate>
<div>
<asp:Label ID="hiddenlabel" runat="server" Text='<%# Eval("get_points")%>' Visible="false">
</asp:Label>
</div>
</ItemTemplate>
</asp:Repeater>