This is a migrated thread and some comments may be shown as answers.

ItemDataBound event

1 Answer 42 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
KS
Top achievements
Rank 1
KS asked on 14 Jul 2010, 01:22 PM
 <telerik:GridBoundColumn DataField="Date" DataFormatString="{0:d}" HeaderText="Date"
                                UniqueName="Date">
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemStyle Width="60px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EndDate" DataFormatString="{0:d}" HeaderText="EndDate"
                                UniqueName="duedate">
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle HorizontalAlign="Center" />
                                <ItemStyle Width="60px" />
                            </telerik:GridBoundColumn>
 <telerik:GridBoundColumn DataField="OrderNumber" HeaderText="Ordrenr." UniqueName="OrderNumber">
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle Width="80px" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="InvoiceNumber" HeaderText="Fakturanr." UniqueName="InvoiceNumber">
                                <HeaderStyle HorizontalAlign="Left" />
                                <ItemStyle Width="80px" />
                            </telerik:GridBoundColumn>

Here I want to check the value of InvoiceNumber in ItemDataBound event

If invoiceNumber= 1234
then
this invoicenumber field need to set visible false

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 14 Jul 2010, 01:34 PM
Hello kalit,

Here is the code for that:

if (e.Item is GridDataItem)
{
   GridDataItem item = e.Item as GridDataItem;
   int invNumber = Convert.ToInt32(DataBinder.Eval(item.DataItem,"InvoiceNumber"));
   ......
}


Regards,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
KS
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or