Rajkumar R

Rajkumar R

  • NA
  • 183
  • 220.5k

Can anyone say how to bind data in to repeater control

Nov 21 2011 6:22 AM
I have tried the following code but it doesn't display data in the repeater control..    
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {           
            LOADINGREAPETER();
        }
    } 
public void LOADINGREAPETER()
    {
        SqlConnection CN = DBUtil.GetCon();
        if (CN.State != ConnectionState.Closed)
            CN.Close();
        CN.Open();        
        string q = "Select Convert(nVarchar,A.Rec_No) CRec,A.Acc_Name Descr,A.Quantity Qty,Convert(nVarchar,A.Sell_Rate) SRate,Sell_CName Sname , Sell_CCode SCCode, Sell_CValue SCValue ,Convert(float,A.Quantity*A.Sell_Rate*Sell_CValue) as SAmount, A.Service_Tax STax,Convert(nVarchar,(A.Quantity*A.Sell_Rate*Sell_CValue)* A.Service_Tax/100)Tax_Amount,Convert(Float,((A.Quantity*A.Sell_Rate*Sell_CValue)+(A.Quantity*A.Sell_Rate*Sell_CValue)* A.Service_Tax/100)) as Net From eLogs_Invoice_Charges_Details A Where A.Invoice_Code='INV1'";
        SqlDataAdapter da = new SqlDataAdapter(q, CN);
        DataTable dtable = new DataTable();
        da.Fill(dtable);
        Repeater1.DataSource = dtable;
        Repeater1.DataBind();
        CN.Close();
    }
Please tell me how to bind data

Answers (3)