with above problem now i want to save that values in database also.so any direction is appreciated.
with above problem now i want to save that values in database also.so any direction is appreciated.
Love is physical attraction and mental destruction
Here's how I handle the paging:
First, create a property:
Then, create your PagedDataSource and set the CurrentPageIndex:Code:public int CurrentPage { get { if (string.IsNullOrEmpty(ViewState("currentPage"))) { return 1; } else { return (int)ViewState("currentPage"); } } set { ViewState("currentPage") = value; } }
Then, you change the CurrentPage property on the event you want to change the page. For example, if your paging was displayed in a dropdown list, use the DropDownList.SelectedIndexChanged event to set CurrentPage equal to the selected value.Code:{ PagedDataSource pgdSource = new PagedDataSource(); { pgdSource.DataSource = yourdatasource; pgdSource.AllowPaging = true; pgdSource.PageSize = 20; pgdSource.CurrentPageIndex = (CurrentPage - 1); } }
jmurrayhead
If you agree, give me rep. If my post helped you, click "Thanks".
If you like it here...throw us a few bones to help support us.
I believe the paging is sorted J.
As I understand it, the issue is, if you change a textbox or dropdown on page 1 and then go to page 2, when you go back to page 1, the new details you entered aren't saved. It's these changes guddu needs to keep.
I would assume the best way would be to update the db when the page changes?
Then the values and ID's of each control would have to be stored in viewstate as well. Then, when a page is clicked, during that event you would have to check if there is a value for the id in viewstate and then set the value of the control to the value in viewstate. The same concept is used here with CheckBoxes: Maintaining Checkbox State in a Listview
jmurrayhead
If you agree, give me rep. If my post helped you, click "Thanks".
If you like it here...throw us a few bones to help support us.
hey can give me link which used c# for this purpose.
Love is physical attraction and mental destruction
jmurrayhead
If you agree, give me rep. If my post helped you, click "Thanks".
If you like it here...throw us a few bones to help support us.
huh.during conversion i m getting error for below code
line 1 col 11: invalid NonModuleDeclaration
Code:Protected Sub AddRowstoIDList() ' Loop through all the current items in the Listview For Each lvi As ListViewDataItem In ListView1.Items ' Find the checkbox in each row Dim chkSelect As CheckBox = CType(lvi.FindControl("chkSelect"), CheckBox) ' If the checkbox is ticked then add the corresponding ID to our private list If (Not (chkSelect) Is Nothing) Then ' Get the ID from the datakeynames property Dim ID As Integer = Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value) If (chkSelect.Checked AndAlso Not Me.IDs.Contains(ID)) Then ' Add the ID to our list Me.IDs.Add(ID) ElseIf (Not chkSelect.Checked AndAlso Me.IDs.Contains(ID)) Then ' Not checked - remove the ID from our list Me.IDs.Remove(ID) End If End If Next End Sub
Love is physical attraction and mental destruction
I'm not sure why it's not converting, but just take the concept and see what you can come up with.
jmurrayhead
If you agree, give me rep. If my post helped you, click "Thanks".
If you like it here...throw us a few bones to help support us.
can u tell me how to convert this line
for my repeater control???Code:' Get the ID from the datakeynames property Dim ID As Integer = Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value)
Love is physical attraction and mental destruction
Code:int ID = Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value);
jmurrayhead
If you agree, give me rep. If my post helped you, click "Thanks".
If you like it here...throw us a few bones to help support us.
Bookmarks