Forms Data Controls :: Hiding A Repeater Div Using A Link Outside The Repeater?
May 25, 2010
I'm so confused I wasn't even sure what to make the title so that it would make sense.
Here is what I have:
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.
I have a repeater control having columns in it.When I bind the control to a data source then some of the columns become empty when there is no data associated with it.I want to hide the column if there is no data associated with it.I was trying to implement a solution given in this thread:
However,I am not sure how to write the logic for hiding and showing the placeholder.I have written some code for the same but that clearly doesn't work.The following is the .aspx as well as the code behind which I am using:
I have a user control that displays a shopping cart in an ecommerce application.
The main cart display is a repeater that renders as a html table. In one of those table columns, there is another repeater to display people associated with the products int he cart (it's a repeater in case there is a line item >1 with multiple people).
I've added an ImageButton that I want to use to change the person associated with the item. At first, when I'd click on it I was getting this error:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
So as an experiment I disabled EventValidation on the page (not the control it's self) and now I do not get an error, but I also do not ever hit the breakpoint I set in the innermost repeater's ItemCommand event.
So I wonder how I might do this without disabling EventValidation, because this control will show up on multiple pages and we don't want to edit them all. Also, I'll need to know not only the repeater containing the control's row that the event came from but also the row index of the repeater containg this one. Is this possible?
what changed do I need to make to my code for it to achieve what I'm after.
At the moment I am getting a "cannot cast to type" error message with the below code.
I have also tried calling the ItemDataBound method in with the parent repeater tags and had no errors but when I clicked on the button it would just move back to the top of the page and would not hide or show any data. Also I have made the div style to none but the first record still shows its child but the rest don't.
I am using a repeater control and i want to use one more repeater control inside the existing repeater control .
<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>
im tryin to create repeater from code behaind using C#. The data bind is working good, im tryin to put some pager. the pager is half working. i can see the pager links at the bottom, i can see the the code split the records to 10 lines each page as i set it but when i click the next link the records stay the same it wont changing for the next 10 records. my code
I am using Linkbutton inside the Repeater Control to display the paging ........and m calling Page change event on client click ....m attaching u code that m using it work fine in some webform but somewhere it didn't go the page change method on clicking page no. .....
I am using "Classified Ad" starter kit of Asp.net 2.0. In the Post Ad feature that using the ad "CategoryPath" control that recursively update link based on user select ad category. After user satisfied with the ad Category selection, the control generate a complete button link of the entire path.
If I am going to convert CategoryPath control from Asp.net to MVC / Ajax, how about I am going to do this?
On my website i have got a product for sale page, which has a ryt side bar with filter options while the left side bar shows the filteration results. On my ryt sidebar i have used accordion with the repeater control which display the searching criteria from database.For instance I have 2 searching criteria model and price , under model accordion there are three models, what I want to acheive is when a user clicks on that specific model , the page should run a query with respect to that click and show bind the results on the repeater of the left side bar, I know the query to get the results but I dunno how to get the value of that hyper link button, coz these buttons will be dynamic it can be 3,4 or 10. how will i get the clicked hyperlink valueso that I can run the query depending on the model selected.
I have set up an asp repeater to go through and display a list of people based on input parameters. Within that repeater I have a repeater that displays specific details about each person. No problem so far.
However, my requirement is that I only display the names, with a plus/minus sign to the left of the name. Clicking on the plus sign will expand that person's information to show the details. Clicking the minus sign will collapse the detail info.
I have a panel set up within my primary repeater that encompasses the secondary repeater.
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?
For the solution, I cannot use any postback methods, because this is all working through ajax. The solution need to be implemented in the asp.net code. I have a List<WebPage> that contains a list of Links (List<Link>) and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater.
<div id="result"> <asp:Repeater runat="server" id="results"> <Itemtemplate> <asp:Repeater runat="server" datasource='<%# Eval("Links") %>'> <Itemtemplate> <tr class="gradeX odd"> <td><%# Eval("Id") %></td> //property of WebPage (part of results repeater) <td><%# Eval("Title") %></td> //property of WebPage (part of results repeater) <td><%# Eval("Url") %></td> //property of WebPage (part of results repeater) <td><%# Eval("URL") %></td>//Property of Link <td><%# Eval("URLType") %></td> //Property of Link <td><%# Eval("URLState") %></td> //Property of Link </tr> </Itemtemplate> </asp:Repeater> </Itemtemplate> </asp:Repeater> </div>
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:
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.