gridview searching by using postback

Last post 07-06-2007 2:59 AM by vr_chaithanya. 3 replies.

Sort Posts:

  • gridview searching by using postback

    06-27-2007, 3:44 AM
    • Loading...
    • vr_chaithanya
    • Joined on 05-21-2007, 1:29 AM
    • Bangalore
    • Posts 8

    Hi,

    I had a griview with some columns for example studentname, schoolname. There is a search button for sname and schoolname. when i searched for schoolname it had displayed all the values inside the grid for schoolname. I had a link for editing the schoolname it has to redirect to another page. My problem is when i click the cancel button in editing page i.e., schoolname it has to redirect to previous searched results. That means it should not dispaly the entire grid it should only display the previous searched result. It should maintain the viewstate can you tell me the coding how to do this. If you have not understood please let me know.

     

    With Regards,

    Raj Chaithanya

    Raj Chaithanya

  • Re: gridview searching by using postback

    06-27-2007, 5:40 AM
    Answer

    Hi,

    You should keep somehow the info for your previous requested page...by example if you use for your search URL parameters, you could do it like this:

    protected System.Web.UI.WebControls.HyperLink CancelLink;

    private void Page_Load(object sender, System.EventArgs e)

    {

    if(!IsPostBack){

    CancelLink.NavigateUrl = Request.UrlReferrer.ToString();

    }

    }

    Regards,

  • Re: gridview searching by using postback

    06-27-2007, 8:04 AM
    Answer
    • Loading...
    • mshokoohian
    • Joined on 05-19-2007, 12:30 PM
    • Iran
    • Posts 98

    Hi,

    I think u need to store search items in session and when u cancel and back to search page, do ur search by values of session.

    In this way u can show last search result to ur user, when she back to search page from any other page.

    Hope help u :-)

    Mojtaba Shokoohian
  • Re: gridview searching by using postback

    07-06-2007, 2:59 AM
    • Loading...
    • vr_chaithanya
    • Joined on 05-21-2007, 1:29 AM
    • Bangalore
    • Posts 8
    Thank q for helping. I did it
    Raj Chaithanya

Page 1 of 1 (4 items)
Microsoft Communities
Page view counter