+ Reply to Thread
Page 3 of 6 FirstFirst 1 2 3 4 5 ... LastLast
Results 21 to 30 of 54

Thread: Create control according to their data type

  1. #21
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    hi actually problem is with commented line.if i comment that line in that case no error.what i m missing?
    // objPds.CurrentPageIndex = CurrentPage - 1;

    Code:
    public partial class ConfigurationTool_EditPackage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!string.IsNullOrEmpty(Request.Form["MemberID"]))
            //{
    
                PackageList dd = PackageListBL.GetExtraInfo(121);
    
                if (dd != null)
                {
    
                    PagedDataSource objPds = new  PagedDataSource();
                    objPds.DataSource = dd;
                    objPds.AllowPaging = true;
                    objPds.PageSize = 5;
                   // objPds.CurrentPageIndex = CurrentPage - 1;
                    rptExtraInfo.DataSource = objPds;
                    rptExtraInfo.DataBind();
                    
                }
                else
                {
    
    
                    rptExtraInfo.DataBind();
                }
            }
        //}
        public int CurrentPage
        {
            get
            {
                // look for current page in ViewState
                object o = this.ViewState["_CurrentPage"];
                if (o == null)
                    return 0; // default page index of 0
                else
                    return (int)o;
            }
    
            set
            {
                this.ViewState["_CurrentPage"] = value;
            }
        } 
    }
    
    Love is physical attraction and mental destruction

  2. #22
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Perhaps your CurrentPage is finding nothing in ViewState and returning 0.

    Then the CurrentPageIndex would be set to 0 - 1 = -1 which would throw an error.

  3. #23
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    but i think ViewState["_CurrentPage"] is default page level property.so what to do for this?
    Love is physical attraction and mental destruction

  4. #24
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    i think this
    Code:
    objPds.CurrentPageIndex = CurrentPage - 1;
    
    should be
    Code:
    objPds.CurrentPageIndex = CurrentPage;
    
    Love is physical attraction and mental destruction

  5. #25
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    hi
    Thank u so much RR about your help so far.now my paging stuff with repeater is fine now problem is to retaim values of page.
    as your know at each page i have form control likes text box ,dropdown .so when user filled all these values at first page and after clicking next go to next page and filled data their also and agian back to previous page the data at this page being lost.

    how to retain these values.
    Love is physical attraction and mental destruction

  6. #26
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Could you save the values in a session when it moves to the next page and then retrieve them from the session when it moves back?

  7. #27
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    some sort of example would be appreciated about session.

    any other way if not willing to use session.
    Love is physical attraction and mental destruction

  8. #28
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    To add items to a session variable, use something like:-
    Code:
    HttpContext.Current.Session.Contents.Add("varName",varValue)
    
    And to retrieve:-
    Code:
    Dim myValue as String = HttpContext.Current.Session.Contents.Item("varName")
    
    I believe you can manually add items to the viewstate to keep their values, although I've not done this before....I guess you could also save the details in a database...

    Maybe someone else might have a better solution...

  9. #29
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    once data filling has done in pages then user will submit .after submit i will save that data into database.

    but problem is i m using paging so during page navigation i m not able to retain values.

    still i m not clear with your example of session??
    Love is physical attraction and mental destruction

  10. #30
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Oh...I see what you mean now....

    Hmmm...not sure...I've not used paging before...Will have to have a think about that...

+ Reply to Thread
Page 3 of 6 FirstFirst 1 2 3 4 5 ... LastLast

Similar Threads

  1. Create/Print Form data
    By Rebelle in forum ASP Development
    Replies: 5
    Last Post: December 10th, 2008, 10:25 AM
  2. Binding data to the RadioButtonList Control
    By Shem in forum .NET Development
    Replies: 2
    Last Post: December 3rd, 2008, 02:42 AM
  3. Replies: 5
    Last Post: June 25th, 2008, 09:07 AM
  4. Data Type Mismatch in Criteria Expression
    By alansidman in forum Microsoft Access
    Replies: 1
    Last Post: April 9th, 2008, 05:33 PM
  5. Type mismatch: HTMLEncode
    By Rebelle in forum ASP Development
    Replies: 20
    Last Post: March 28th, 2008, 10:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO