Oooh fudgicles,
I have a repeater control and everything works great except. . . Every time the form does a post back, which is often, it scrolls to the top (Grrrr). Unfortunately (and apparently) MaintainScrollPositionOnPostback="true" has no affect on the repeater control. I looked on-line and as is customary in .NET there are plenty of "work-around" solutions plenty of which look promising, none of which I could get to work. The most promising solution involved an UpdatePanel and some JavaScript, but that didn't work because it required a second ScriptManager (you can only have one) and I needed the other for my date picker extension. So all I want is the page to stay where it is on callback (I just hate dealing with irate users) Any suggestions?
Here is the ASP for the repeater:
And here is the function that is called from the DropDownList that causes the post back:Code:<asp:Repeater ID="Repeater1" runat="server" > <HeaderTemplate> <table class="formTbl" border="0" cellspacing="2px"> <colgroup> <col width="75px" /> <col width="75px" /> <col width="50px" /> <col width="60px" /> <col width="60px" /> <col width="125px" /> <col width="100px" /> </colgroup> <tr> <td class="top" align="center" colspan="7">Sanitary Pipes Cleaned</td> </tr> <tr class="grayBack" valign="bottom"> <td align="center">From MH</td> <td align="center">To MH</td> <td align="center">Basin</td> <td align="right">Footage</td> <td align="center">Size</td> <td align="center">WorkType</td> <td align="center">Times Jetted</td> </tr> <tr> <td colspan="7"> <hr /> </td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td align="center"> <asp:Label ID="From_MH" runat="server" Text='<%# Eval("UP_MH_NO")%>'></asp:Label> </td> <td align="center"> <asp:Label ID="To_MH" runat="server" Text='<%# Eval("DN_MH_NO")%>'></asp:Label> </td> <td align="center"> <asp:Label ID="Basin" runat="server" Text='<%# Eval("BASIN")%>'></asp:Label> </td> <td align="right"> <asp:Label ID="Asbuilt_Length" runat="server" Text='<%# Eval("ASBUILT_LENGTH")%>'></asp:Label> </td> <td align="right"> <asp:Label ID="Diameter" runat="server" Text='<%# Eval("DIAMETER")%>'></asp:Label> </td> <td align="center"> <asp:DropDownList ID="lstWorkType" runat="server" AutoPostBack="True" width="125px"> <asp:ListItem Selected="True">Maintenance</asp:ListItem> <asp:ListItem>Grease</asp:ListItem> <asp:ListItem>Root Cutting</asp:ListItem> <asp:ListItem>Televising</asp:ListItem> <asp:ListItem>Trouble</asp:ListItem> </asp:DropDownList> </td> <td align="center"> <asp:DropDownList ID="lstTimesJetted" runat="server" width="50px" OnSelectedIndexChanged="lstTimesJetted_SelectedIndexChanged"> <asp:ListItem Selected="True">1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> </asp:DropDownList> </td> </tr> <tr > <td align="center">Comment:</td> <td colspan="5"> <asp:TextBox ID="txtComment" runat="server" Width="370px"></asp:TextBox> </td> <td > <asp:Label ID="PipeID" runat="server" Text='<%# Eval("MAIN_ID")%>' Visible="false" ></asp:Label> </td> </tr> </ItemTemplate> <SeparatorTemplate> <td colspan="7"> <hr /> </td> </SeparatorTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater>
Note: the reason CalculateFootage() is a separate function is because I also call it in the Page_On_LoadCode:Protected Sub lstTimesJetted_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) CalculateFootage() End Sub Protected Sub CalculateFootage() Dim vRepeater1 As Repeater = Repeater1 Dim vAsbuilt_Length As Label Dim vLstTimesJetted As DropDownList Dim vItems As RepeaterItemCollection Dim vItem As RepeaterItem Dim vAsbLen As Decimal = 0 Dim vJetVal As Decimal = 0 Dim vJetted As Decimal = 0 vItems = vRepeater1.Items For Each vItem In vItems vAsbuilt_Length = DirectCast(vItem.FindControl("Asbuilt_Length"), Label) vLstTimesJetted = DirectCast(vItem.FindControl("lstTimesJetted"), DropDownList) vAsbLen = CDec(vAsbuilt_Length.Text) vJetVal = CDec(vLstTimesJetted.SelectedValue) vJetted = vJetted + (vJetVal * vAsbLen) Next txtTotFootage.Text = vJetted.ToString End Sub




Reply With Quote