The program executes, but no result of DatagridView Binding.
here is the designing section page:-
you can see the gridview control. Now let's see the page in runtime:-
The Gridiview is not visible. Please help me in this error. The source code is following:-
I know that something is missing in the source code. please mention where the error lies.


Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 18, 2013, 9:16 PM EDT
try like this:
it just a sample
in aspx:
in .cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
public partial class Default8 : System.Web.UI.Page
{
string connStr = ConfigurationManager.ConnectionStrings["ConStr"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
bind();
}
private void bind()
{
SqlConnection conn = new SqlConnection(connStr);
SqlDataAdapter da = new SqlDataAdapter("Select * from Movie", conn);
DataSet ds = new DataSet();
da.Fill(ds);
dgvMovie.DataSource=ds.Tables[0];
dgvMovie.DataBind();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
bind();
}
}
here i create a separate method for gird binding and call in page load and button click so it will bind the record when you submit.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 18, 2013, 8:09 PM EDT
CaptionAlign="Top" ToolTip="Movie Details" >
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 18, 2013, 8:40 PM EDT
First check weather data is getting saved or not in your database. And put the below code in page load
Regards,
Iftikar
Bineesh ViswanathRank #1,680 · 907 reputationPosted Aug 18, 2013, 8:57 PM EDT
Now My thought is how to display data in Gridview during btnSubmit Click.
here is the Page:-
My intention is to display data at the time of submit button click(when I press submit, I want gridView to show that data)
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 18, 2013, 9:07 PM EDT
Regards,
Iftikar
Ring ZhongRank #6,843 · 255 reputationPosted Aug 19, 2013, 1:43 AM EDT