I called radgrid.rebind() in linkbutton click.But the needdatasource event of that grid is not firing.Any help..
The aspx code is
<telerik:RadDock runat="server" ID="rddockPrjTypes" Title="Project Types">
<ContentTemplate>
<telerik:RadGrid runat="server" ID="grdProjectTypes" Skin="Vista" AutoGenerateColumns="False"CssClass="gridnew" GridLines="None" ShowHeader="false">
<ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView NoDetailRecordsText="" NoMasterRecordsText="">
<Columns>
<telerik:GridTemplateColumn UniqueName="TemplateColumn"> <ItemTemplate>
<asp:LinkButton ID="lnkPTypes" runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.projecttypedesc") %>'></asp:LinkButton> (<asp:LinkButton ID="lnkCount" runat="server" Text='<%#DataBinder.Eval(Container,"DataItem.counts") %>'></asp:LinkButton> ) </ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings>
<PopUpSettings ScrollBars="None"></PopUpSettings> </EditFormSettings><ExpandCollapseColumn Visible="False" Resizable="False"><HeaderStyle Width="20px"></HeaderStyle></ExpandCollapseColumn> </MasterTableView></telerik:RadGrid> </ContentTemplate></telerik:RadDock>
thanks
16 Answers, 1 is accepted

I guess you are setting the NeedDataSource event handler in the code behind. Sending your code behind will be more good.
Thanks
Shinu.

Protected Sub grdProjectTypes_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdProjectTypes.NeedDataSource
Try
Dim ds As New DataSet()
ds = GetProjectTypes(
"PType")
If ds.Tables(0).Rows.Count > 1 Then
grdProjectTypes.DataSource = ds
End If
Catch ex As Exception
Dim er As ErrHandler = New ErrHandler(ex)
er.RaiseError()
End Try
End Sub


Protected
Sub lnkRemoveFilter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkRemoveFilter.Click
grdProjectTypes.Rebind()
grdPriority.Rebind()
grdStatus.Rebind()
End Sub
and when clicking on the linkbutton sometimes only grdProjectTypes needdatasource is working.Sometimes only grdPriority needdatasource event is working .wht wib the prbm.I actually much confused by this prblm
Plz help me....

Could you please paste the portion of the code in which you are adding the NeedDataSource Event handler ?
Shinu

i m using .net2005.
Did u mean
Protected Sub grdProjectTypes_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdProjectTypes.NeedDataSource
Try
Dim ds As New DataSet()
ds = GetProjectTypes(
"PType")
If ds.Tables(0).Rows.Count > 1 Then
grdProjectTypes.DataSource = ds
End If
Catch ex As Exception
Dim er As ErrHandler = New ErrHandler(ex)
er.RaiseError()
End Try
End Sub

Sorry for the confusion. I asked if you have set something like this in the code behind:
RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource); |
The event will not be raised if you have not set the proper event handler.
Shinu

thanks

Try adding the NeedDataSource event handler either in the code behind or set it in the aspx page.
//Code behind
VB:
AddHandler RadGrid1.NeedDataSource, AddressOf Me.RadGrid1_NeedDataSource |
or
ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource"> |
Regards
Princy

i added another grid.Its rebind is working properly.It doesnot have the event handler.All grids have the same aspx codes.The only difference is Errorful grids are within RadDock.

After adding the event handler the needdatasource is executing twice.But when i call rebind,needdatasource is not executing.
I tried by seting the enableviewstate to true and false.But no change.Rebind is stil not executing



Thanks

ie,
onneeddatasource="grid1_needdatasource" .i removed it.Now its working only once.
But my prbm is grid1.rebind() is not workg.I didnt get any solution
Thanks Scott

RadGrid1.DataSource = null; |
RadGrid1.Rebind(); |
Thanks,
Sharmin