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 LenkaPosted Aug 19, 2013, 1:16 AM
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.
Ring ZhongPosted Aug 19, 2013, 5:43 AM
Iftikar HussainPosted Aug 19, 2013, 1:07 AM
Regards,
Iftikar
Bineesh ViswanathPosted Aug 19, 2013, 12:57 AM
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 HussainPosted Aug 19, 2013, 12:40 AM
First check weather data is getting saved or not in your database. And put the below code in page load
Regards,
Iftikar
Sanjeeb LenkaPosted Aug 19, 2013, 12:09 AM
CaptionAlign="Top" ToolTip="Movie Details" >