Question

I have a grid control called RadGrid1 and with a breakpoint in RadGrid1_ItemDataBound, but when I run my aspx application, the breakpoint is not being triggered.

my code is:

<telerik:RadGrid ID="RadGrid1" runat="server" Width="980px" CssClass="GridDisplay" 
            AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="true" AllowPaging="true" 
            AutoGenerateColumns="False" AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="false" ItemStyle-Height="20px" 
            ClientSettings-ActiveRowIndex="true" EnableViewState = "false" OnDeleteCommand = "RadGrid1_OnDelete" 
            OnItemCreated = "RadGrid1_ItemCreated" OnItemDatabound = "RadGrid1_ItemDatabound" OnNeedDataSource = "RadGrid1_NeedDataSource">

    <telerik:GridTemplateColumn DataField="Confirmed" HeaderText="Confirmed" UniqueName="Confirmed" Visible="true">
        <ItemTemplate>
            <asp:CheckBox ID="chkVerified" runat="server" AutoPostBack="true" 
            Checked='<%# bool.Parse(Eval("Verified").ToString()) %>'
            Enabled='<%# !!Convert.ToBoolean(Convert.ToInt32(Eval("Verified").ToString())) %>'
            ToolTip='<%# Eval("NoConfirmDesc").ToString() %>'
            />
        </ItemTemplate>
    </telerik:GridTemplateColumn>

aspx.cs

private void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    { }
} 
Was it helpful?

Solution

In aspx, the handler for Databound event is called RadGrid1_ItemDatabound

OnItemDatabound = "RadGrid1_ItemDatabound"

but in code behind, your method is spelled with capital B in databound

void RadGrid1_ItemDataBound

Make sure you place the breakpoint inside the right method.

OTHER TIPS

Could you make sure AutoEventWireup="true" for the page?

<%@ Page ... AutoEventWireup="true" %>

In addition, make sure that there are not spaces between them OnItemDatabound="RadGrid1_ItemDatabound"

One thing I notice in your code is you want to use OnNeedDataSource to bind Data if you use RadGrid.

OnNeedDataSource="RadGrid1_NeedDataSource"

maybe you forgot to register or are not correctly registering the OnItemDataBound Event

Or maybe you are not databinding the control?

RadGrid1.DataSource= mydatasource;
RadGrid1.DataBind();

As last possibility maybe iis express and visualstudio debugger are not working correclty

I suggest to kill iisexpress process and then rebuild the solution then try again

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top