You must Sign In to post a response.
  • Category: ASP.NET

    How to get the identity of button from one page to another page

    Hello Sir/Madam

    I have one aspx page with three different button, now when i click on particular button the page is redirect to another page. Now my question is I want to know that whcih button user was clicked ? can you please suggest how can i do this using javascript/jquery (without session and Query string)

    Bhavik Shah
  • #765155
    Try this:
    WebForm1.aspx page:
    .buttonclass {
    $(document).ready(function ()
    $('.buttonclass').click(function ()
    localStorage.setItem("id:", $(this) + ", Value/Text: " + $(this).val());
    <asp:Button ID="btnAdd1" runat="server" OnClick="btnAdd1_Click" Text="Redirect 1" CssClass="buttonclass" />
    <asp:Button ID="btnAdd2" runat="server" OnClick="btnAdd1_Click" Text="Redirect 2" CssClass="buttonclass" />

    WebForm1.cs page:
    protected void btnAdd1_Click(object sender, EventArgs e)

    WebForm2.aspx page:
    <script type="text/javascript">
    function GetPrevControlID()
    alert("Control from previous page-> " + localStorage.getItem("id:"));

    <body onload="GetPrevControlID();">

    Hope it helps.
    Shashikant Gurav

  • #765168
    Basically scripting is run on client side, so I am doubt to getting that values after postback on another page, may be you can check below link

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • Sign In to post your comments