how to change button text when dropdownlist text is selected as Active then button text should show deactive and when dropdownlist text is selected as deactive then button text should show active??????????????????????????
task will be performed on one button only so that depending upon button text if condition should work
Satyapriya NayakPosted Dec 28, 2013, 10:36 PM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication8
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.Items.Add("---select-");
DropDownList1.Items.Add("Active");
DropDownList1.Items.Add("Deactive");
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Button1.Text = "";
if (DropDownList1.Text == "Active")
{
Button1.Text = "Deactive";
Button1.Enabled = false;
}
else if (DropDownList1.Text == "Deactive")
{
Button1.Text = "Active";
Button1.Enabled = true;
}
else
{
Button1.Text = "Button1";
Button1.Enabled = true;
}
}
}
}