how to insert data in this way

Posted by Shail12345 under ASP.NET on 11/16/2013 | Points: 10 | Views : 688 | Status : [Member] | Replies : 1
Hello sir,
I insert user information in this way
UserName(textbox)
Email(textbox)
mobno.(textbox)
EmployementStatus(Emloyement Or UnEmployee)Dropdownlist
CompanyName(textbox)
loanAmmount(textbox)

If i select Unemployee in dropdownlist then hide the (companyname)textbox and insert the table data
and select employeement then all data insert in data base

how to hide (companyname)textbox plz give me any idea
thanks




Responses

Posted by: Satyapriyanayak on: 11/17/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication6._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<p>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</p>
<p>
&nbsp;</p>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<p>
<asp:TextBox ID="txt_company" runat="server"></asp:TextBox>
</p>
<p>
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</p>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>


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 WebApplication6
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.Items.Add("Choose EmployementStatus");
DropDownList1.Items.Add("Emloyement");
DropDownList1.Items.Add("UnEmloyement");
}
}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (DropDownList1.Text == "UnEmloyement")
{
txt_company.Visible = false;
}
else
{
txt_company.Visible = true;
}
}
}
}


If this post helps you mark it as answer
Thanks

Shail12345, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response