UPDATED:
I am trying to get to the DataPager using this code but I don't seem to have the correct syntax.
Dim myDP As DataPager = TryCast(ListView1.LayoutTemplate("DataPager1", DataPager).FindControl("DataPager1"), DataPager)
I have a DataPager inside of a ListView and would like to read the value of the textbox within the DataPager...
<asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="1">
<Fields>
<asp:TemplatePagerField OnPagerCommand="TemplatePagerField_OnPagerCommand" >
<PagerTemplate>
<div>
<asp:LinkButton ID="FirstButton" runat="server" CommandName="First"
Text="<<" Enabled='<%# Container.StartRowIndex > 0 %>' />
<asp:LinkButton ID="PreviousButton" runat="server" CommandName="Previous"
Text='<%# (Container.StartRowIndex - Container.PageSize + 1) & " - " & (Container.StartRowIndex) %>' Visible='<%# Container.StartRowIndex > 0 %>' />
<asp:Label ID="CurrentPageLabel" runat="server"
Text='<%# (Container.StartRowIndex + 1) & "-" & (IIf(Container.StartRowIndex + Container.PageSize > Container.TotalRowCount, Container.TotalRowCount, Container.StartRowIndex + Container.PageSize)) %>' />
<asp:LinkButton ID="NextButton" runat="server" CommandName="Next"
Text='<%# (Container.StartRowIndex + Container.PageSize + 1) & " - " & (IIf(Container.StartRowIndex + Container.PageSize*2 > Container.TotalRowCount, Container.TotalRowCount, Container.StartRowIndex + Container.PageSize*2)) %>' Visible='<%# (Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount %>' />
<asp:LinkButton ID="LastButton" runat="server" CommandName="Last" Text=">>" Enabled='<%# Container.TotalRowCount %>' />
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" style="width: 25px;">
</td>
<td align="center" style="width: 200px;">
<asp:TextBox ID="txtSlider" runat="server" AutoPostBack="True" Text='<%# (Container.StartRowIndex + 1) %>' OnTextChanged="txtSlider_TextChanged" Width="200px"></asp:TextBox>
<asp:SliderExtender ID="SliderExtender1" runat="server" Orientation="Horizontal"
TargetControlID="txtSlider"></asp:SliderExtender>
</td>
<td align="right" style="padding-right: 25px" class="PageNumber">
<asp:Label ID="lblPaging" runat="server" Text='<%# "Page " & (Container.StartRowIndex + 1) & " of " & (Container.TotalRowCount) %>'></asp:Label>
</td>
</tr>
</table>
</div>
</PagerTemplate>
UPDATED:
I am trying to read the TB value in the DataPager...
Protected Sub txtSlider_TextChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim lv As ListView = TryCast(sender, ListView)
Dim pager As DataPager = TryCast(lv.FindControl("DataPage1"), DataPager)
Dim tb As TextBox = TryCast(pager .FindControl("slider1"), TextBox)
Dim CurrentPage As Integer = tb.Text