i need to use condition in dropdown list
My source code is
<link type="text/css" href="../jquery/jquery.datepick.css" rel="stylesheet" />
<script language="ecmascript" type="text/javascript" src="../jquery/jquery.min.js"></script>
<script type="text/javascript" src="../jquery/jquery.datepick.js"></script>
<script type="text/javascript" language="javascript">
$(function()
{
$('#ctl00_ContentPlaceHolder1_txtdate').datepick();
$('#inlineDatepicker').datepick({onSelect: showDate});
});
function showDate(date) {
alert('The date chosen is ' + date);
}
</script>
<script type="text/javascript" language="javascript">
function sss()
{
var sure=document.getElementById("ctl00_ContentPlaceHolder1_TextBox8").value;
if(sure=="")
{
alert("Enter Suresh");
document.getElementById('ctl00_ContentPlaceHolder1_TextBox8').focus();
return false;
}
}
</script>
<form id="form1" runat="server">
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<table class="style1" width="100%" style="border-style: groove; border-width: thin">
<tr style="background: #1d599e; height: 10px;">
<td align="center" style="color:White" colspan="2">
DAILY PERFORMANCE</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Label ID="Label4" runat="server" style="font-size: 13px"
Text="Fille the below "></asp:Label>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label11" runat="server" style="font-size: 11px"
Text="Date"></asp:Label> </td>
<td>
<asp:TextBox ID="txtdate" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="lempid" runat="server" style="font-size:11px" Text="Employee Id"></asp:Label>
</td>
<td class="style14">
<asp:Label ID="lemid" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label12" runat="server" style="font-size: 11px"
Text="Name"></asp:Label> </td>
<td>
<asp:TextBox ID="txtnamee" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label2" runat="server" style="font-size: 11px"
Text="Project"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlproject" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList6_SelectedIndexChanged" Width="175px"
ValidationGroup="a">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">New</asp:ListItem>
<asp:ListItem Value="2">Continuing</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<table class="style1" style="border-style: groove; border-width: thin"
width="100%">
<tr style="background: #1d599e; height: 10px;">
<td align="center" colspan="2" style="color:White">
DAILY PERFORMANCE </td>
</tr>
<tr>
<td align="center" class="style3">
</td>
<td class="style14">
</td>
</tr>
<tr>
<td align="left" class="style5" colspan="2">
<asp:Label ID="Label3" runat="server" style="font-size: 12px; color: #666666;"
Text="Project Status has been given below"></asp:Label>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label5" runat="server" style="font-size:11px;"
Text="Project Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtprojname" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label6" runat="server" style="font-size:11px;" Text="Description"></asp:Label>
<br />
</td>
<td class="style7">
<asp:TextBox ID="txtdescription" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label7" runat="server" style="font-size:11px;" Text="Duration"></asp:Label>
<br />
</td>
<td>
<asp:TextBox ID="txtduration" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label8" runat="server" style="font-size:11px;" Text="Platform"></asp:Label>
<br />
</td>
<td>
<asp:TextBox ID="txtplatform" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label13" runat="server" style="font-size:11px;" Text="Task"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddltask" runat="server" AutoPostBack="True"
Height="21px" onselectedindexchanged="DropDownList5_SelectedIndexChanged"
Width="183px">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">New</asp:ListItem>
<asp:ListItem Value="2">Continuing</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td>
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View3" runat="server">
<table class="style1" style="border-style: groove; border-width: thin"
width="100%">
<tr style="background: #1d599e;">
<td align="center" colspan="2" style="color:White">
DAILY PERFORMANCE</td>
</tr>
<tr>
<td class="style12">
</td>
<td>
</td>
</tr>
<tr>
<td class="style11">
<asp:Label ID="Label9" runat="server" style="font-size:11px;"
Text="Project Title"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtprojtitle" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
<asp:Label ID="Label10" runat="server" style="font-size:11px;"
Text="Project Module"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtprojmod" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style11">
<asp:Label ID="Label1" runat="server" style="font-size: 11px;" Text="TaskName"></asp:Label>
</td>
<td>
<asp:TextBox ID="txttasnam" runat="server" Height="15px" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" class="style12">
<asp:Label ID="Label14" runat="server" style="font-size:11px;" Text="Status"></asp:Label>
</td>
<td>
<asp:DropDownList ID="ddlstat" runat="server" AutoPostBack="True"
Height="21px" onselectedindexchanged="DropDownList4_SelectedIndexChanged"
Width="166px">
<asp:ListItem Value="0">select</asp:ListItem>
<asp:ListItem Value="1">Completed</asp:ListItem>
<asp:ListItem Value="2">Pending</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" class="style12">
<asp:Label ID="Label15" runat="server" style="font-size:11px;" Text="Pending"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtpending" runat="server" Height="52px" Width="174px"
TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
<tr>
<td align="center" class="style12" colspan="2">
<asp:Label ID="lpjtd" runat="server" style="font-size:11px;" Text=""></asp:Label>
<asp:Button ID="Button4" runat="server" onclick="Button4_Click" Text="Submit" />
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</form>
My aspx.cs code is
protected void Page_Load(object sender, EventArgs e)
{
Label15.Visible = false;
txtpending.Visible = false;
if (!IsPostBack)
{
string qrs = "select ID,Name from Mgt_Registration where ID='" + Session["Emp"] + "' ";
DataSet ds = new DataSet();
ds = su.GETDS(qrs);
foreach (DataRow dr in ds.Tables[0].Rows)
{
lemid.Text = dr["ID"].ToString();
txtnamee.Text =dr["Name"].ToString();
}
}
Label15.Visible = false;
//TextBox10.Visible = false;
MultiView1.Visible = true;
MultiView1.SetActiveView(View1);
}
protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlstat.SelectedItem.ToString() == "Completed")
{
txtpending.Text = "";
MultiView1.Visible = true;
MultiView1.SetActiveView(View3);
Label15.Visible = false;
txtpending.Visible= false;
}
else if (ddlstat.SelectedItem.ToString() == "Pending")
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View3);
Label15.Visible = true;
txtpending.Visible = true;
}
}
protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddltask.SelectedItem.ToString() == "Select")
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View2);
}
else if (ddltask.SelectedItem.ToString() == "New")
{
txtprojtitle.Text = "";
txtprojmod.Text = "";
txttasnam.Text = "";
MultiView1.Visible = true;
MultiView1.SetActiveView(View3);
}
else if (ddltask.SelectedItem.ToString() == "Continuing")
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View3);
string qr = ("select ProjectTitle,ProjectModule,TaskName from Technology");
DataSet ds = new DataSet();
ds = su.GETDS(qr);
foreach (DataRow dr in ds.Tables[0].Rows)
{
txtprojtitle.Text = dr["ProjectTitle"].ToString();
txtprojmod.Text = dr["ProjectModule"].ToString();
txttasnam.Text = dr["TaskName"].ToString();
}
}
}
protected void Button4_Click(object sender, EventArgs e)
{
string qry = "insert into Technology (Date,EmployeeId,Name,Project,ProjectName,Description,Duration,Platform,Task,ProjectTitle,ProjectModule,TaskName,Status,Pending) values ('" + txtdate.Text;
qry += "','" + lemid.Text;
qry += "','" + txtnamee.Text;
qry += "','" + ddlproject.SelectedItem.ToString();
qry += "','" + txtprojname.Text;
qry += "','" + txtdescription.Text;
qry += "','" + txtduration.Text;
qry += "','" + txtplatform.Text;
qry += "','" + ddltask.SelectedItem.ToString();
qry += "','" + txtprojtitle.Text;
qry += "','" + txtprojmod.Text;
qry += "','" + txttasnam.Text;
qry += "','" + ddlstat.SelectedItem.ToString();
qry += "','" + txtpending.Text;
qry += "')";
su.Insert(qry);
lpjtd.Text = "s";
MultiView1.Visible = true;
MultiView1.SetActiveView(View1);
Clear();
}
protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlproject.SelectedItem.ToString() == "New")
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View2);
}
else if (ddlproject.SelectedItem.ToString() == "Continuing")
{
string qre = "select ProjectName,Description,Duration,Platform from Technology where pk in (select max(pk) from Technology where EmployeeId='" + lemid.Text + "' )";
DataSet ds = new DataSet();
ds = su.GETDS(qre);
MultiView1.SetActiveView(View2);
MultiView1.Visible = true;
foreach (DataRow dr in ds.Tables[0].Rows)
{
txtprojname.Text = dr["ProjectName"].ToString();
txtdescription.Text = dr["Description"].ToString();
txtduration.Text = dr["Duration"].ToString();
txtplatform.Text = dr["Platform"].ToString();
}
}
}
private void Clear()
{
txtnamee.Text = "";
txtdate.Text = "";
txtplatform.Text = "";
txtprojmod.Text = "";
txtprojname.Text = "";
txtprojtitle.Text = "";
txtpending.Text = "";
txtdescription.Text = "";
txtduration.Text = "";
txttasnam.Text= "";
lemid.Text = "";
ddlproject.SelectedValue = "0";
ddltask.SelectedValue = "0";
ddlstat.SelectedValue = "0";
}
}
in that i need in continuing field i need a msg that u have completed the project if i choose the Continuing (i need to show project is complted alreay) and multiview view3 have to show the ProjectTitle,ProjectModule,TaskName also.
else if (ddltask.SelectedItem.ToString() == "Continuing")
{
MultiView1.Visible = true;
MultiView1.SetActiveView(View3);
string qr = ("select ProjectTitle,ProjectModule,TaskName from Technology");
DataSet ds = new DataSet();
ds = su.GETDS(qr);
foreach (DataRow dr in ds.Tables[0].Rows)
{
txtprojtitle.Text = dr["ProjectTitle"].ToString();
txtprojmod.Text = dr["ProjectModule"].ToString();
txttasnam.Text = dr["TaskName"].ToString();
}