dimanche 19 avril 2015

asp.net repeater "eval" not reading value from table containong 200 records?

My problem is the "place": '<%# Eval("placer") %>' in the repeater is not extracting data from table_quake(column: placer). the column placer in the quake table contain 200 records and all 200 record is fetch and place in the repeater. All eval works but only place is not extracting


notes: When i fetch little record like 10 the '<%# Eval("placer") %>' work fine but with 200 records it does not extract.


My sample data for the column placer is:



placer
6km WNW of The Geysers, California
10km S of Anza, California
19km SW of North Nenana, Alaska
...........
......


here is my asp.net script to create the repeater:



<%@ Page Language="VB" AutoEventWireup="false" CodeFile="earthquakemap.aspx.vb" Inherits="earthquakemap" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">

<html xmlns="http://ift.tt/lH0Osb">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<script src="http://ift.tt/11czYwS" type="text/javascript"></script>
<script src="http://ift.tt/1JVNPKo" type="text/javascript" ></script>
<script type="text/javascript">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
{
"times": '<%# Eval("times") %>',
"lat": '<%# Eval("latitude") %>',
"lng": '<%# Eval("longitude") %>',
"dep": '<%# Eval("depth") %>',
"magni": '<%# Eval("magnitude") %>',
"magtype": '<%# Eval("mag_type") %>',


"place": '<%# Eval("placer") %>'


"typo": '<%# Eval("type") %>',

}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>


My code behind:



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As DataTable = Me.GetData("select * from table_quake")
rptMarkers.DataSource = dt
rptMarkers.DataBind()



End If
End Sub

Private Function GetData(ByVal query As String) As DataTable
Dim conString As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
Dim cmd As New SqlCommand(query)
Using con As New SqlConnection(conString)
Using sda As New SqlDataAdapter()
cmd.Connection = con

sda.SelectCommand = cmd
Using dt As New DataTable()
sda.Fill(dt)
Return dt
End Using
End Using
End Using
End Function

Aucun commentaire:

Enregistrer un commentaire