shuchi

shuchi

  • NA
  • 10
  • 0

Problem in binding DataBound Column in DataGrid

Dec 1 2006 2:37 PM

Problem in Binding Databound Columns of DataGrid.

I am using C#.net, Visual Web Developer 2005, SQL Server 2000.

I have a datagrid in my WebForm which has some Template Columns and DataBound Columns.

Now in One of my Bound Column, I would like to display database results based on my SQL query.

I know that I can display it using following code in HTML(.aspx file).

<asp:BoundColumn DataField="OSP_FSD" HeaderText="ETD Date" DataFormatString ="{0:MM/dd/yyyy}"></asp:BoundColumn>

Where OSP_FSD is one of the Database column name.

But My problem is I can not put DataField = "OSP_FSD" as it refers to only one column of database.

I have to bind ETD Date Column based on following cirteria. Split is one of the result of a main SQL query.

If Split = 1

{

// OSP_FSD is Database Column name

Bind it with OSP_FSD

}

else

{

// ORD_ETD is database column name

Bind it with ORD_ETD

}

I think I can not use DataItemBound Event has it just allows to play with binded data. and in my case I have to play with data before it binds the datagrid.

Please HELP!