Hello everyone,
I have three tables CompanyMst ,BranchMst and DeptMst.
CompanyMst contains:
CompanyId(Primary Key) ,CompanyName.
BranchMst contains:
CompanyId(Foreign key),BranchId(Primary Key),BranchName.
DeptMst contains:
UserId,BranchId(Foriegn key),DeptId(Primary Key),DeptName.
Now in the registration forms I am filling the DeptName and BranchName through dropdownlist using the DeptMst and BranchMst table.
Now as most of the application requires that the first item should be --Select--
But when I add DropdownList1.Items.Add("--Select--");
in page load it just overwrites the first value of the dropdownlist.
And when I tried to add the following after the databind() of dropdownlist:
objcomponent.Items.Insert(0, new ListItem("--Select", "0"));
It gives the erorr :Can't insert or update foreign key .
Please help as I know this is very small problem ,I have tried lot of things just looking for perfect solution.
Please help me to solve my problem.Please help,If anyone can explain me through coding then it will become easy for me.
Thanking you all.