We have a requirement where i need to delete the view state of particular repeater from Jquery/javascript.
Example
I have two repeater repeater 1 and repeater 2
onclientclick of button i want remove all the data of the repeater 1 along with the particular repeater viewstate.
i am able remove the data of the repeater using
$(tableid).remove();
but view state of the repeater still exist. I can not disable the view state of the repeater otherwise few functionality will not work.
You can't do that.
In this case, don't use a repeater. Create your own version of the repeater using js/jquery and html markup. You can maintain the state and load data trough callbacks using ajax.
Related
I am having a repeater control in my Asp.Net application, I just want to change this repeater into grid view control because i want to apply paging. i didn't want to add custom paging in repeater instead i want to use default grid view paging .
can any body suggest me what changes are required??
I will suggest Use Jquery Paging instead.
convert repeater to Gridvue https://www.experts-exchange.com/questions/26344088/convert-from-repeater-to-gridview.html
Binding a DataTable to a Repeater control in ASP.NET Binding a DataTable to a Repeater control in ASP.NET
I have taken input textbox in Repeater ItemTemplate and on page load i call a function which fires tokeninput js file
on page load autosuggest works for only first textbox in repeater control .How to make it functional for all textboxes in repeater control.
Any help is much appriciated!
Instead of using selector by id
$("#my-text-input").tokenInput("/url/to/your/script/");
use selector by css class
$(".myclass").tokenInput("/url/to/your/script/");
and assign it to all required texboxes using
CssClass="myclass"
How can I print Repeater data?
I am having a Search page which makes search query according to the input given and populate the repeater. Now I want to print this result displayed in the repeater. How can I do that on the onClick button event of a "Print" asp:Button?
If you want to provide search capability, follow below steps-
If you are filling repeater on PageLoad with whole data, remember to prevent your repeater binding always on PageLoad using IsPostBack property.
Now on Click event get the filtered data, and bind it with repeater.
Hope this will solve your problem, If need any help please update your question with code.
Thanks.
I have a repeater in my page with some pre-conditions such as a checkbox list and listboxes that dictate what the datasource for the repeater brings back. A button is clicked which will databind the repeater which works fine. However if the user decides they want to add something else in or remove something they can check/uncheck some fields and then hit the button again which will rebind the repeater and change what is displayed, however the viewstate of all the current controls in the repeater will be lost.
Binding the repeater in the initialization event would not be possible because the ViewState for the checkboxlist/listbox values are not available at that point in the page lifecycle, and those values are required in order to pass as parameters into my datasource for the repeater.
What are my options for maintaining the state of my repeater controls?
repeater control binding fully recreates all of children controls inside repeater templates. Because new DataBind result may (or may not) contains extremely different data inside repeater.
What kind of controls and their state you want to maintain inside repeater? Maybe using ordinal html controls and operating with theirs through Request.Form collection would be a better way?
If you want to save data from repeater before applying new databinding, best place for making it is a Page.PreRender event. In this event all Page controls already recreated and their viewstate already restored. So you may iterate by Repeater.Items collection and save data from repeater row by row. And after saving all the data you may rebind repeater controls according current filter values from page.
I have worked with both the controls for simple application development . Both almost do the same functionality. What is the difference between them ?
There is a table here that compares the data bound server controls:
http://weblogs.asp.net/anasghanem/archive/2008/09/06/comparing-listview-with-gridview-datalist-and-repeater.aspx
GridView always renders as a grid. Repeater allows you to create your own template layout. For instance, you can put things in divs. GridView also has a much more rich object model, while repeater is rather simplistic.
Yes, you can achieve similar results with both, but they are nowhere near the same thing.
Both these controls are Data-Bound Web Server control.
GridView : It displays data as a table and has ability to preform sort, paging,edit and delete a record.
Repeater : has fewer templates then GridView. It renders a read-only list from the datasource.