Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have designing in my webpage i have enter bill number and click the button the customer information and image display in grid view.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
namespace photoshops
{
    public partial class WebForm2 : System.Web.UI.Page
    {
        SqlConnection conn = new SqlConnection();
        protected void Page_Load(object sender, EventArgs e)
        {
        
            conn.ConnectionString = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
            Load_GridData(); // call method below
        }
        void Load_GridData()
        {
            conn.Open(); // open the connection 
            SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings", conn);
            DataSet ds = new DataSet();
            Sqa.Fill(ds);  // fill the dataset 
            GridView1.DataSource = ds.Tables[0]; // give data to GridView
             GridView1.DataBind();
            conn.Close();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string strText = TextBox1.Text;
            SqlDataAdapter Sqa = new SqlDataAdapter("select * from tblphotosettings where BillNo= " + strText + "", conn);
        }
    }
}

The page is run full table record display but i want to enter the billno only related information disply how to correct
Posted
Updated 1-May-11 23:34pm
v2

u have not specified databind() method

C++
GridView1.DataSource = ds.Tables[0];
GridView1.Databind();
 
Share this answer
 
Comments
kannan 2 2-May-11 5:04am    
Than you but error

Error 2 'System.Web.UI.WebControls.GridView' does not contain a definition for 'Databind' and no extension method 'Databind' accepting a first argument of type 'System.Web.UI.WebControls.GridView' could be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\photoshops\photoshops\WebForm2.aspx.cs 35 23 photoshops
Ashishmau 2-May-11 5:17am    
its not Databind()..its a DataBind().. Don't write yourself as it comes in intellisense...i was just giving u direction
kannan 2 2-May-11 5:26am    
the run page is gridview display. table full details display.but only i have enter the billno and click the button and display image.but intially the all billno and record display how to correct
Ashishmau 2-May-11 5:59am    
use like query in database to filter according to your entered bill no and then rebind it with gridview..
kannan 2 2-May-11 6:27am    
but image not disolay
Try,

GridView1.DataBind();


notice that c# is case sensitive b in DataBind was small

It will work
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900