Robin Agrahari
Robin Agrahari

Reputation: 817

taking query string values without full postback

i have a page in which the left column contains category list and the right column will display the corresponding items on choosing a particular category from the left

each category list contains a hyperlink whose navigate url contains query string values.

on clicking the link i get the items listed in the right matching the querystring value

question is: i want to prevent the full postback and at the same time to catch the querystring values to without which i wont be able to get the items list in the right.

i used an update panel but the full post back is happening again.

is there any way to get query string values without full postback???

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

    <div class="rightsec">

    <h5>Categories</h5>
        <asp:Accordion ID="Accordion1" runat="server">
            <Panes>
                <asp:AccordionPane ID="AccordionPane1" runat="server">
                    <Header>
                        <h4>
                            Electronics</h4>
                    </Header>
                    <Content>
                        <div class="rightsec_content">
                            <ul>
                                <li>
                                      <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="show_products.aspx?category=Electronics&sub_category=Cameras Accessories">Camera Accessories</asp:HyperLink>   

                                </li>

                             </ul>
                        </div>
                    </Content>
                </asp:AccordionPane>

        </asp:Accordion>
    </div>

     </ContentTemplate>
    </asp:UpdatePanel>


    <asp:UpdateProgress ID="UpdateProgress1" runat="server" 
        AssociatedUpdatePanelID="UpdatePanel1">
    <ProgressTemplate>
     <table align="center">
            <tr>
                <td>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/staticimages/progress_bar_animated (1).gif"
                        ImageAlign="Top" />
                </td>
            </tr>
        </table>

    </ProgressTemplate>
    </asp:UpdateProgress>

Upvotes: 4

Views: 1410

Answers (3)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

You can put such a value in the CommandArgument property of your link button and then you will be able to access it in code behind like...

protected void lbtn_Click(object sender, EventArgs e)
{
    ((LinkButton)(sender)).CommandArgument 
}

Upvotes: 0

Amr Elgarhy
Amr Elgarhy

Reputation: 69002

You can get it using javascript: http://www.west-wind.com/weblog/posts/884279.aspx

Then can use any ajax way to send this back to the server.

Upvotes: 0

Bhavik Goyal
Bhavik Goyal

Reputation: 2796

Well, yes you can do this But it's not the easy task..

You need to write some JQUERY and have to use AJAX with that.

And using that you can easily achieve this.

i am not much familiar but this, but i know that this can be done using AJAX and JQUERY.

It might also be required to add some web services in your project to achieve this.

This link can help you http://api.jquery.com/jQuery.ajax/.

Upvotes: 1

Related Questions