Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET .NET
first page
html code:
<asp:Button ID="btn_view" runat="server" Text="View" onclick="btn_view_Click" />
<asp:Button ID="btn_view" runat="server" Text="update" onclick="btn_update_Click" />
c# code:
    protected void btn_view_Click(object sender, EventArgs e)
    {
         string str = "";
        Session["btn_view"] = str;
        Response.Redirect("secondpage.aspx");       
    }
 protected void btn_update_Click(object sender, EventArgs e)
    {  
        Session["update"]=str_d ;
        Response.Redirect("secondpage.aspx");
    }
second page:
html code:
<asp:Button ID="btn_Delete" runat="server" Text="Delete" 
                                onclick="btn_Delete_Click" />
         
                        <td id="cell_update"  runat="server" class="textbox_align" >
                             
                            <asp:Button ID="btn_Update" runat="server" Text="Update" 
                                onclick="btn_Update_Click" />
c# code:
    protected void Page_Load(object sender, EventArgs e)
    {
        cell_view.InnerText = Convert.ToString(Session["btn_view"]);
 if (StrView == "")
        {
            btn_Update.Visible = false;
            btn_Delete.Visible = true;
 
        }
        else
        {
            btn_Update.Visible = true;
}
plz modified this code
Posted 17-Apr-13 8:53am
Edited 17-Apr-13 20:38pm
v7
Comments
ThePhantomUpvoter at 17-Apr-13 14:05pm
   
A solution to what? This is just a code dump. No question asked or description of a problem given.
Sergey Alexandrovich Kryukov at 17-Apr-13 14:31pm
   
ASP.NET? Please add a tag "ASP.NET".
—SA
@AmitGajjar at 18-Apr-13 1:31am
   
You can use session variable to store your visibility flag for your next page control.
Rohan Leuva at 18-Apr-13 1:39am
   
then whats the question,whats the error,whats the problem? Frame the question properly so that somebody can respond to you.
TusharKhairnar at 18-Apr-13 2:03am
   
Use Query string in first page and check in second page if query string having value then disabled the controls.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
you can make use of query string. try like below.
 
First Page.
protected void btn_view_Click(object sender, EventArgs e)
{
    string str = "";
    Session["btn_view"] = str;
    Response.Redirect("secondpage.aspx?Type=view");       
}
protected void btn_update_Click(object sender, EventArgs e)
{  
    Session["update"]=str_d ;
    Response.Redirect("secondpage.aspx?Type=upd");
}
 
Second Page.
protected void Page_Load(object sender, EventArgs e)
{
    if(Request.QueryString["Type"].ToString() == "view")
    {
        btn_Update.Visible = false;
        btn_Delete.Visible = true;
    }
    else if(Request.QueryString["Type"].ToString() == "upd")
    {
        btn_Update.Visible = true;
    }    
}
 
refer Passing variables between pages using QueryString[^] for more on query string.
 
hope it helps.
  Permalink  
Comments
Member 9959371 at 18-Apr-13 1:56am
   
thanks for solve my problem
Karthik Harve at 18-Apr-13 2:02am
   
welcome. !!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100