Reputation: 1
i have two page ... the first page include gridview and button(Add new student)
the first column in gridview is hyperlink(ID) when i click on any ID of students its open the second page and show me the student information
in the second page i have textbox>> and button(update)
so how can i change the text button(update) in the second page to be (add) ? when i click on the button in first page (add new student)
Upvotes: 0
Views: 64
Reputation: 34846
In the Page_Load
of the second page, do this:
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
if(Request.QueryString["ID"] != null)
{
YourButton.Text = "Update";
}
else
{
YourButton.Text = "Add";
}
}
}
Upvotes: 1
Reputation: 2524
Something like this:
btnEdit.Text = Request.QueryString["ID"] != null ? "Update" : "Add";
Upvotes: 0