"Scott Roberts" wrote:
>"shamila" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> we are trying to pass a value to format a value in the datacolumn.
But
>> when we pass the datacolumn , it does not give me the value in the
>> column, instead gives me the column name.
>>
>> the following code gives me an error invalid cast .
>>
>> protected void ItemDataBoundEventHandler(object
>> sender,DataGridItemEventArgs e)
>> {
>> if(e.Item.ItemType==ListItemType.Item ||
>> e.Item.ItemType==ListItemType.AlternatingItem)
>> {
>> for (int i = 2; i < oDT1.Columns.Count; i++)
>> {
>> DataColumn dc = oDT1.Columns[i];
>> string s = FormatDataColumn(ref dc);
>> e.Item.Cells[i-2].Text= s;
>>
>> }
>> }
>> }
>
>What is "oDT1"? You should probably be using e.Item.DataItem.
>
>The type of e.Item.DataItem will vary depending on what is bound to the
>DataGrid.
>
>
oDT1 is a a datatable. I cannot access the Datatype if i use
e.Item.DataItem.
shamila
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com