sqldatasource and gride view

  • Thread starter Thread starter Husam
  • Start date Start date
H

Husam

Hi EveryBody:

How can I add a sqldatasource and gridview and configure them progrmaticlly?

any help or redirection will be appreciated

regard's

Husam
 
In the code behind, You can call

gridView1. DataSource = SQlDataSource1;
gridView.DataBind();

You should do the databind for any and all gridview related events you are
raising, like
Selecting, Updating, deleting, Paging etc..
And, initial databind could be in PageLoad, like

if(!Page.IsPostback)
{
gridView1. DataSource = SQlDataSource1;
gridView.DataBind();
}

you could also provide any DataSource related parameters in code behind
similar to..

SqlDataSource1.SelectCommand = "Select * from employees where employee
id=@id";
Parameter selectParam = new Parameter();
selectParam.DbType = DbType.Integer;
selectParam.DefaultValue = "100"; // Employee id...
SqlDataSource1.SelectParameters.Add(selectParam.)



Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top