Repeater Control And MaintainScrollPositionOnPostback
Jul 27, 2011
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).Here is the ASP for the repeater:
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" />
[code]...
Note: the reason CalculateFootage() is a separate function is because I also call it in the Page_On_Load
View 10 Replies
Similar Messages:
Feb 3, 2014
I am using a repeater control and i want to use one more repeater control inside the existing repeater control .
Like this:
<asp:Repeater ID="Repeater1" runat="server"> <HeaderTemplate> </HeaderTemplate>
<ItemTemplate>
<!-- start child repeater --> Here I want to use one repater control <!-- end child repeater -->
</ItemTemplate>
</asp:Repeater>
View 1 Replies
Jun 17, 2010
I want to bind parent repeater item index in child repeater control using inline code not code behind side.
For example
[Code]....
View 2 Replies
Dec 15, 2010
I inherited some web shop project (asp.net 3.5, web forms, visual studio 2008 pro). On one page I have MaintainScrollPositionOnPostback set to true. When shopping cart (user control loaded in master page) is empty, then asp.net is not generating javascript code required for scroll position. When I add some items to the cart, then everything works fine.
how to find part of the code which is responsible for this issue? I don't have an access to the 3rd party profilers.
View 1 Replies
Feb 18, 2011
Edit: I have a working solution already - I would just like to know why my original attempt didn't work. My original attempt is the code below.
I'm using the approach I found here:[URL] 306154 to implement a nested Repeater. Each parent item has one or more children items (the point of having the nested Repeater) with a dropdown horizontally aligned to each child item. In an effort to re-use the nested part of the Repeater I wanted to develop that piece as a user control but couldn't get it to work. I am wondering if it is even possible and if so how?
Here is my user control apsx:
<asp:Repeater ID="NestedRepeater" runat="server">
....
<ItemTemplate>
<tr class="text" id="RepeaterItemRow" runat="server">
<td>
<%#DataBinder.Eval(Container.DataItem, "Name") %>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</ItemTemplate>
And here is my code behind for the user control. I noticed when I debugged NestedDataSource was null even though in the parent page load the data is there:
public DataSet NestedDataSource
{
get;
set;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
NestedRepeater.DataSource = NestedDataSource;
NestedRepeater.DataBind();
}
}
In the parent Repeater in the `<ItemTemplate> I have:
<asp:RepUC ID="NestRep" runat="server" NestedDataSource='<%#((DataRowView)Container.DataItem).Row.GetChildRows("nestedrel") %>'>
And finally the page code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BuildWBS();
}
}
private void BuildPage()
{
DataSet ds = new DataSet();
ds = DataAccessLayer.GetData("System");
ds.Relations.Add("nestedrel", ds.Tables[0].Columns["Id"], ds.Tables[1].Columns["ParentId"]);
ParentRepeater.DataSource = ds;
ParentRepeater.DataBind();
}
The page loads but nothing relating to the repeater appears on the screen. So, can you see anything wrong with what I have? Is the way I tried doing this even possible?
View 1 Replies
Oct 15, 2010
lets say I want to make a label of repeater1 visible in repater2's ItemCommand() method..
e.Item.FindControl("rpt1Label").Visible=True;
is not working..how else do you do it ?
[EDIT]
changed that to repeater1.FindControl("rpt1Label").Visible=True;
This is throwing object reference null exception
View 1 Replies
Aug 20, 2010
I have a content form based on a MasterPage. Within this form I have a custom, collapsible control which inherits from HtmlContainerControl. One of the controls I use is a DropDownList which has AutoPostBack enabled.
I need to maintain the current scroll position across postbacks so I have set the MaintainScrollPostionOnPostBack property to true within the web.config file. Unfortunately, this doesn't seem to work as the position is not maintained and there is no extra javascript present in the code when I view the source.
This content form does also contain some AJAX controls for date selection (CalendarExtender).
View 5 Replies
Mar 15, 2010
I have used a MaintainScrollPositionOnPostBack = true function in 2.0 but is giving a stack overflow at line 0 error. What is the fix to this. I understand that it is a bug in IE.
View 2 Replies
Jan 31, 2011
I have a page with GridView, one of templates of which is ascx page used like Field Template. This ascx page has a button to add some data to page, but by pressing this button "MaintainScrollPositionOnPostback" not working with main page.
Tried rather much from web, but still no result.
View 1 Replies
Sep 30, 2010
If I have a custom user control (say, MyCustomControl.ascx) which contains a number of other controls including a repeater, is there any way to expose that repeater's templates as templates for MyCustomControl?
For example, I would want to be able to do this:
[code]....
There could potentially be more than one repeater or other templated controls within the parent control, in which case I would like to be able to expose all of those templates for all of the controls in the same way.
My first thought was to simply expose the repeater's templates as ITemplate properties on MyCustomControl, but that didn't work since there's no (obvious) way to access the repeater's DataItem from the templates doing it that way.
View 2 Replies
Nov 30, 2010
I set the MaintainScrollPositionOnPostback="true" control in the .aspx page code and for one of the pages, it works great. But in the second page, it doesn't work at all. The two pages are nearly identical in code, with just the addition of some more textboxes on the second page, at the bottom of the page. Both pages have virtually identical code above the <html> tag, with the exception of the values assigned to the "CodeFile" and "Inherits" controls in the <Page> tag, to correspond with each page's VB codebehind.
Both pages have two buttons at the bottom. The first page has a button for submitting a new record and a second button for clearing the fields. The second page has a button for updating an existing record and a second button for inserting a new record (for revision control). Both pages submit data to Oracle database tables. I've been trying to figure this out for the last several hours, searching this forum and Google, but so far I've come up with nothing. I can't figure out why the MaintainScrollPositionOnPostback won't work on the second page, but is fine on the first.
View 1 Replies
Feb 16, 2010
I have master page and i am using maintainScrollPositionOnPostBack="true"
but it is not working.
View 2 Replies
Jun 23, 2010
Does anyone know why MaintainScrollPositionOnPostback="True" works in IE, Firefox, and Opera .. but, not in Chrome or Safari?
View 1 Replies
Mar 17, 2011
I have a checkbox in a repeater control. How to get the User,Administrator,Security Admin as the checkbox Names ?
private string[] AvailableRoles = { "User", "Administrator", "Security Admin" };
Repeater_Roles.DataSource = AvailableRoles; Repeater_Roles.DataBind();
[code]....
View 3 Replies
Nov 26, 2010
I need to access a control inside a repeater and change its properties. To enable it or not. I got an erorr message Object reference not set to an instance of an object. Here is my code inside a method. protected void
rptCAP_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
LinkButton lnDel = (LinkButton)rptCap.FindControl("lnkDelete");
lnkDel.Enabled = false; //<<<<< this is where the error occur
}
The name of the repeater control is id="rptCAP"
View 3 Replies
Mar 17, 2010
How to create Grid view control inside Repeater control.
View 7 Replies
May 20, 2010
i have a repeater control, with a button in it.
how do i make the button NOT visible on the page_load programaticaly
View 3 Replies
Aug 23, 2010
This has got me stumped. I am trying to find a checkbox in a dynamically loaded asp.net Repeater template. The template works fine and the databinding is fine and everything displays fine but I can't find the control!
This is the repeater code (I have a similar one for the alternate template with a different style):
[Code].....
View 4 Replies
Apr 21, 2010
I have nested a repeater control in Gridview. Right now it is showing gridview rows and repeater header for every case(whether data is there or not for that particular grid view row in the repeater control). I want to hide the gridview row and repeater control header when there is no data present for that particular gridview row. That case I handled at code level by filtering the resulted data table.
Now the another problem I am facing: I have allowed the paging on the gridview i.e. pagesize 3. When page loads it works fine, but when I go to page 2 then it generates following error: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
Below is the code to fill the grid, paging and fill repeater on rowdatabound event of grid.
[code].....
View 1 Replies
Mar 2, 2010
I need to display a database table in a repeater control but it should be asynchronous and should not be reloaded. When I click the button the next rows need to be appeared without loading. My superior says I need to use Ajax and repeater control. But I only know the synchronous way using something like
Repeater.DataSource();
Repeater.DataBind();
View 7 Replies
Jan 8, 2011
I have a repeater with a checkbox and a textbox, that I am binding to a datasource. Depending on conditions from the code behind, I want to be able to disable the checkbox and textbox dynamically.
Currently this is what I have within the
[Code]...
The #DataBinder.Eval(Container.DataItem, "DISABLE") is being set to the string value of "true" on the code behind yet when the code is ran, I recieve a InvalidCastException error.
View 1 Replies
Sep 16, 2010
I want to use a repeater as a 5x5 grid. I have 25 records and I want to display them in 5 rows and 5 columns.
View 3 Replies
Dec 15, 2010
which is the best asp.net control to allow a user to enter data into a table and then save it. Then the codebehind can iterate the the rows and save each row to the database. Then load the table when the user wants to see the data. Would this be the repeater or Gridviewcontrol?
View 6 Replies
Sep 2, 2010
I have a repeater with which I want to use to show a user control multiple times, populated with dataCurrently, I have this:
<asp:Repeater runat="server" ID="MyRepeater" >
<ItemTemplate>
<uc1:MyItems ID="MyItems1" runat="server" />
</ItemTemplate>
</asp:Repeater>
View 2 Replies
Dec 4, 2010
I have a repeater which nests one or more custom control instances. Each custom control instance has a drop down and a button called "Update".
This all works fine when JS is on.
However with JS off, I get the "Invalid postback or callback argument. Event validation is enabled..." error.
Thinking about this, I imagine the following is happening:
ASP.NET creates ViewState for the page. When the page is posted back, the viewstate should be passed back to the page via the js hooks that ASP.NET puts in place. However, because JS is OFF, this isn't passed back. ASP.NET then flags a mismatch between the ViewState that it expects, and the Viewstate that it receives.
View 1 Replies