Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I have 2 dropdown boxes,1 textbox and a checkbox list with 4 checklist items on my page.I have taken the checkbox list datatype as bit in sql.If there exists any data in DB,all the details would be displayed on the page.There is also a link button from where user can add the data into DB.Now when user enters the values and selects 1 or more check boxes on the webpage, all the selected details have to be stored in database.Im using MVC .pls help
Posted
Comments
Tejas Vaishnav 19-Aug-11 4:21am    
Can you describe your question in detail for better understanding "what you want"

1 solution

Hi,
C#
dtbl = SPEmployee.Details(DateTime.Today);

for (int i = 0; i < cbxEmployeeAll.Items.Count; i++)
{
if (cbxEmployeeAll.Items[i].Selected == true)
{
infoPerformanceJudge.JudgeId = SPPerformanceJudge.PerformanceJudgeGetMax();
infoPerformanceJudge.Empcode = cbxEmployeeAll.Items[i].Value;
infoPerformanceJudge.Description = "";
infoPerformanceJudge.Status = true;
infoPerformanceJudge.Extra2 = "";
SPPerformanceJudge.PerformanceJudgeAdd(infoPerformanceJudge);
lblMessage.Visible = true;
lblMessage.ForeColor = Color.Green;
lblMessage.Text = "Saved successfully";
}
}


For View details,
C#
foreach (DataRow drow in dtbl.Rows)
{
foreach (ListItem lstitem in cbxEmployeeAll.Items)
{
if (lstitem.Value == drow.ItemArray[1].ToString())
{
lstitem.Selected = true;
}
}
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900