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

No record to display msg in page navigation

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
nallamani
Top achievements
Rank 1
nallamani asked on 08 Oct 2008, 05:31 AM
Hi
   I am using Slider for the page navigation and it work for all other pages in our project .But I have problem in the below code.It doesnt Shows the records in the second page.I am getting No records to display message even if I have those records displayed in single page if  I am not using the page size option.
My code....
Client side.

 

<telerik:RadAjaxManager id="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadGridPages">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadGridPages" LoadingPanelID="RadAjaxLoadingPanel1"/>

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="50">

 

 

<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />

 

 

</telerik:RadAjaxLoadingPanel>

 

 

<telerik:RadGrid id="RadGridPages" CssClass="RadGrid" EnableTheming="False" EnableEmbeddedBaseStylesheet="False" AllowSorting="True" AllowMultiRowSelection="true"

 

 

Skin="" runat="server" Width="100%" AllowPaging="True" AutoGenerateColumns="False" PageSize="5" >

 

 

<alternatingitemstyle cssclass="RadGridItem" />

 

 

<ItemStyle CssClass="RadGridItem" ></ItemStyle>

 

 

<HeaderStyle CssClass="RadGridHeader"></HeaderStyle>

 

 

<PagerStyle Mode="Slider" alwaysvisible="True" CssClass="RadGridPager" Visible="true" EnableSEOPaging="True" ></PagerStyle>

 

 

<ClientSettings EnablePostBackOnRowClick="false">

 

 

<Selecting AllowRowSelect="true" />

 

 

</ClientSettings>

 

 

<MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="False" Width="100%">

 

 

<CommandItemTemplate>

 

 

<div style="padding:10px 0px;" class="newtd">&nbsp;&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete the Webpage(s)?')"

 

 

runat="server" CommandName="DeleteSelected" CausesValidation="false" ><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Delet.gif" /> Delete the Webpage(s)</asp:LinkButton>

 

 

&nbsp;&nbsp;&nbsp;

 

 

<asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="../Images/icons/Refresh.gif" /> Refresh </asp:LinkButton>

 

 

</div>

 

 

</CommandItemTemplate>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn UniqueName="SrlNo" AllowFiltering="False" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="2%" >

 

 

<ItemTemplate >

 

 

<asp:Label ID="lblSrlNo" runat="server" />&nbsp;&nbsp;

 

 

<asp:Label ID="lblSelectedNew" Text='<%# Container.DataItem("WebSite") & "_" & Container.DataItem("PageName") %>' runat="server" Visible="false"></asp:Label>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridClientSelectColumn HeaderStyle-Width="3%" />

 

 

<telerik:GridBoundColumn DataField="WebSite" UniqueName="WebSite" ItemStyle-HorizontalAlign="Left" HeaderText="Website" ShowSortIcon="false" ></telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="PageName" UniqueName="PageName" ItemStyle-HorizontalAlign="Left" HeaderText="Webpage" ShowSortIcon="false" ></telerik:GridBoundColumn>

 

<%

-- <telerik:GridBoundColumn DataField="OriginalLocation" UniqueName="OriginalLocation" HeaderText="Original Location" ItemStyle-HorizontalAlign="Left" ShowSortIcon="false"></telerik:GridBoundColumn>

 

--

%>

 

 

<telerik:GridBoundColumn DataField="DeletedDate" UniqueName="DeletedDate" HeaderText="Deleted Date" ItemStyle-HorizontalAlign="Left" ShowSortIcon="false"></telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn UniqueName="Restore" HeaderText="Restore" AllowFiltering="False">

 

 

<ItemTemplate>

 

 

<asp:LinkButton ID="LinkButton2" runat="server" Text="Restore" CommandName="PageName" CommandArgument='<%# Container.DataItem("WebSite") & "_" & Container.DataItem("PageName") %>' ></asp:LinkButton>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

</MasterTableView>

 

 

<FilterMenu EnableTheming="True" Skin="WebBlue" enableembeddedbasestylesheet="False">

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</FilterMenu>

 

 

</telerik:RadGrid>

 

and my Server side code...is

Imports

Telerik.Web.UI

 

Partial

Class Clients_ManageRecycled

 

 

Inherits System.Web.UI.Page

 

 

Dim oDb As New CMSDatabase

 

 

Dim SqlQry As String = ""

 

 

Dim ClientName As String = ""

 

 

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

 

 

Dim UserTheme As MyThemes = Val(Session("@Theme"))

 

 

Me.Theme = UserTheme.ToString

 

 

End Sub

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

Ajax.Utility.RegisterTypeForAjax(

Me.GetType)

 

ClientName = oDb.ExecuteScaler(

"Select DbName from clients where clientid =" & Request.QueryString("CID"))

 

 

' LinkButton1.Attributes.Add("Onclick", "javascript:return(fn_ValidateDelUsers(this.form));")

 

Session(

"AppSortOrder") = "Asc"

 

Session(

"AppSortName") = "Name"

 

 

 

End Sub

 

 

Protected Sub txtSearch_TextChanged(ByVal sender As Object, ByVal e As EventArgs)

 

 

Dim txt As TextBox = TryCast(DirectCast(sender, TextBox), TextBox)

 

 

Dim list As RadComboBox = DirectCast(((txt.NamingContainer).FindControl("rcbFieldName")), RadComboBox)

 

 

Dim [option] As String

 

 

If list.SelectedValue = "RestorePath" Then

 

[option] =

" = "

 

 

Else

 

[option] =

" LIKE "

 

 

End If

 

 

Dim filterExpression As String

 

 

If [option] = " = " Then

 

filterExpression =

"(" + list.SelectedValue + [option] + txt.Text + ")"

 

 

Else

 

filterExpression =

"(" + list.SelectedValue + [option] + "'" + txt.Text + "%'" + ")"

 

 

End If

 

RadGridPages.MasterTableView.FilterExpression = filterExpression

RadGridPages.MasterTableView.Rebind()

 

End Sub

 

 

Protected Sub RadGridPages_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGridPages.NeedDataSource

 

 

Try

 

 

Dim DT As New DataTable

 

 

Dim MysitePath As String = Replace(ConfigurationManager.AppSettings("MapPath"), "/", "\")

 

MysitePath = Mid(MysitePath, 1, InStrRev(Mid(MysitePath, 1, Len(MysitePath) - 1),

"\"))

 

MysitePath = MysitePath &

"_Recycled\" & ClientName & "\"

 

hidRecycledPath.Value = MysitePath

 

Dim Dir As New DirectoryInfo(MysitePath)

 

DT.Columns.Add(

New Data.DataColumn("PageName"))

 

DT.Columns.Add(

New Data.DataColumn("OriginalLocation"))

 

DT.Columns.Add(

New Data.DataColumn("DeletedDate"))

 

DT.Columns.Add(

New Data.DataColumn("WebSite"))

 

 

Dim DR As Data.DataRow

 

 

For Each Website As DirectoryInfo In Dir.GetDirectories

 

 

For Each WebPage As FileInfo In Website.GetFiles("*.aspx")

 

 

'Response.Write(Website.Name & "\" & WebPage.Name & "<br>")

 

DR = DT.NewRow()

DR.Item(

"PageName") = Replace(WebPage.Name, WebPage.Extension, "")

 

DR.Item(

"OriginalLocation") = Website.Name & "_Stage"

 

DR.Item(

"DeletedDate") = WebPage.LastWriteTime

 

DR.Item(

"WebSite") = Website.Name

 

DT.Rows.Add(DR)

 

Next

 

 

Next

 

DT.AcceptChanges()

RadGridPages.Visible =

True

 

RadGridPages.DataSource = DT

 

Catch ex As Exception

 

RadGridPages.Visible =

False

 

lblMsg.Text =

"No File Found"

 

 

End Try

 

 

 

End Sub

 

 

Protected Sub RadGridPages_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridPages.ItemDataBound

 

 

If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.GridItemType.Item Then

 

 

'e.Item.Cells(3).Text = e.Item.DataSetIndex + 1

 

 

Dim lbl As Label

 

lbl =

CType(e.Item.FindControl("lblSrlNo"), Label)

 

lbl.Text = e.Item.ItemIndex + 1

 

Dim lblchk As Label

 

lblchk =

CType(e.Item.FindControl("lblSelectedNew"), Label)

 

 

End If

 

 

End Sub

 

 

Protected Sub RadGridPages_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridPages.ItemCommand

 

 

If e.CommandName = "PageName" Then

 

 

Dim sql As String = ""

 

 

Dim Odt As New DataTable

 

sql =

"select * from " & ClientName & ".dbo.Recycled where WebPageName like '" & e.CommandArgument.ToString.Split("_")(1) & "'"

 

 

'Response.Write(sql)

 

 

If oDb.IsExist(sql) Then

 

Odt = oDb.GetDataTable(sql)

 

Dim Tree As New ManageTree

 

 

Dim StructID As Decimal

 

 

For Each dr As DataRow In Odt.Rows

 

 

'Response.Write(dr.Item("ParentPath"))

 

 

Dim fileOldAspx As New FileInfo(hidRecycledPath.Value & e.CommandArgument.ToString.Split("_")(0) & "\" & e.CommandArgument.ToString.Split("_")(1) & ".aspx")

 

 

Dim fileOldAspxVb As New FileInfo(hidRecycledPath.Value & e.CommandArgument.ToString.Split("_")(0) & "\" & e.CommandArgument.ToString.Split("_")(1) & ".aspx.vb")

 

 

If File.Exists(hidRecycledPath.Value & e.CommandArgument.ToString.Split("_")(0) & "\" & e.CommandArgument.ToString.Split("_")(1) & ".aspx") Then

 

fileOldAspx.MoveTo(dr.Item(

"ParentPath"))

 

fileOldAspxVb.MoveTo(dr.Item(

"ParentPath") & ".vb")

 

 

End If

 

StructID &=

"," & Tree.CreateWebPage(e.CommandArgument.ToString.Split("_")(1), dr.Item("ParentID"), Request.QueryString("CID"), e.CommandArgument.ToString.Split("_")(0))

 

sql =

"delete from " & ClientName & ".dbo.Recycled where WebPageName like '" & e.CommandArgument.ToString.Split("_")(1) & "'"

 

oDb.ExecuteNonQuery(sql)

 

Next

 

 

Dim MyLoadscript As String = "parent.fraMnu.AddNode(""" & ClientName & """, """ & StructID & """);"

 

Page.ClientScript.RegisterStartupScript(

Me.GetType, "MyLoadscript", MyLoadscript, True)

 

 

'RadGridPages.Rebind()

 

 

End If

 

 

End If

 

 

End Sub

 

 

 

Protected Sub RadGridPages_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridPages.DeleteCommand

 

 

Dim Wbpage As Label

 

 

Dim Sql As String

 

 

Dim i As Integer

 

Wbpage =

CType(e.Item.FindControl("lblSelectedNew"), Label)

 

File.Delete(hidRecycledPath.Value & Wbpage.Text.Split(

"_")(0) & "\" & Wbpage.Text.Split("_")(1) & ".aspx")

 

File.Delete(hidRecycledPath.Value & Wbpage.Text.Split(

"_")(0) & "\" & Wbpage.Text.Split("_")(1) & ".aspx.vb")

 

Sql =

"select structureid from " & ClientName & ".dbo.Recycled where WebPageName like '" & Wbpage.Text.Split("_")(1) & "'"

 

 

Dim MyLoadscript As String = "parent.fraMnu.AddNode(""" & ClientName & """, """ & oDb.ExecuteScaler(Sql) & """);"

 

Page.ClientScript.RegisterStartupScript(

Me.GetType, "MyLoadscript", MyLoadscript, True)

 

Sql =

"delete from " & ClientName & ".dbo.Recycled where WebPageName like '" & Wbpage.Text.Split("_")(1) & "'"

 

oDb.ExecuteNonQuery(Sql)

 

'RadGridPages.Rebind()

 

 

End Sub

 

 

Protected Sub RadGridPages_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridPages.ItemCreated

 

 

If TypeOf e.Item Is GridPagerItem AndAlso TryCast(sender, RadGrid).PagerStyle.Mode = GridPagerMode.Slider Then

 

 

TryCast(TryCast(e.Item, GridPagerItem).Controls(0).Controls(1), RadSlider).EnableEmbeddedBaseStylesheet = True

 

 

TryCast(TryCast(e.Item, GridPagerItem).Controls(0).Controls(1), RadSlider).EnableEmbeddedSkins = True

 

 

TryCast(TryCast(e.Item, GridPagerItem).Controls(0).Controls(1), RadSlider).Skin = "WebBlue"

 

 

End If

 

 

End Sub

 

End

Class

 

One more thing this works fine if I change the page navigation mode to other mode other than slider.


Very urgent...Help me

2 Answers, 1 is accepted

Sort by
0
Kiara
Top achievements
Rank 1
answered on 13 Oct 2008, 12:27 PM
nallamani, I took a look at your code but did not find anything wrong with it. My only guess is that you have to debug it step by step to see whether the rows with the data are passed to the grid when paging is started when dragging the slider. Also make sure you use the latest version of RadControls for ASP.NET Ajax (2008.2.1001).

Kiara
0
nallamani
Top achievements
Rank 1
answered on 16 Oct 2008, 11:54 AM
Still I have the issue....Can you help me with that
Tags
Grid
Asked by
nallamani
Top achievements
Rank 1
Answers by
Kiara
Top achievements
Rank 1
nallamani
Top achievements
Rank 1
Share this question
or