TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sivakumar
NA
551
220.1k
Gridview paging is not working correctly
Mar 22 2016 11:19 AM
Hi ,
I need pagination for my asp.net gridview
I write code like below but its not work correctly.
This is my c# code :
protected void Button1_Click(object sender, EventArgs e)
{
string url = "http://maps.google.com/maps/api/geocode/xml?address=" + txtsearch.Text + "&sensor=false";
WebRequest request = WebRequest.Create(url);
using (WebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
DataSet dsResult = new DataSet();
dsResult.ReadXml(reader);
DataTable dtCoordinates = new DataTable();
dtCoordinates.Columns.AddRange(new DataColumn[4] { new DataColumn("Id", typeof(int)),
new DataColumn("Address", typeof(string)),
new DataColumn("Latitude",typeof(string)),
new DataColumn("Longitude",typeof(string)) });
var latitude = string.Empty;
var longitude = string.Empty;
if (dsResult.Tables["location"] != null && dsResult.Tables["location"].Rows.Count > 0)
{
latitude = dsResult.Tables["location"].Rows[0]["lat"].ToString();
longitude = dsResult.Tables["location"].Rows[0]["lng"].ToString();
map.Lattitude = float.Parse(latitude);
map.Longitude = float.Parse(longitude);
map.Radius = float.Parse(txtdemo.Text);
dsLocation= mapBL.GetLocation(map);
GridView2.DataSource = dsLocation;
GridView2.DataBind();
}
}
}
}
This is gridview onchange :
protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView2.PageIndex = e.NewPageIndex;
GridView2.DataSource = dsLocation;
GridView2.DataBind();
}
but this is not work properly
Please send correct code for that.
Thanks
Reply
Answers (
2
)
How can i pass the hidden field value of another page?
Required a sample Quiz project in Asp.Net-2.0 version