这是我的代码。我试图通过使用此MyResponses()插入数据。这是我的下一个点击事件。
nextclick event
{
Section surveySection = DataAccess.AccessSurveySectionByParameters(currentSurvey.EmplID, currentSurvey.UnitId, currentSurvey.SurveyId, currentSurvey.Sort.ToString(), NextStep, GetSurveyResponses());
PopulateSurveySection(currentSurvey, surveySection);
}
private string MyResponses()
{
string resp = "";
foreach (Control ctr in pnlSurveySection.Controls)
{
if (ctr is Table)
{
Table tbl = ctr as Table;
foreach (TableRow tr in tbl.Rows)
{
string sres = "";
string currid = tr.Cells[0].Attributes["ID"];
TableCell tc = tr.Cells[1];
if(currid.StartsWith("editable"))
{
currid.Substring(0, 14);
foreach (Control ctrc in tc.Controls)
{
if (ctrc is TextBox)
{
sres = currid + "||" + (ctrc as TextBox).Text.Trim();
}
else if (ctrc is RadioButtonList)
{
sres = currid + "||" + (ctrc as RadioButtonList).SelectedValue;
}
else if (ctrc is DropDownList)
{
sres = currid + "||" + (ctrc as DropDownList).SelectedValue;
}
else if (ctrc is CheckBoxList)
{
sres = currid + "||" + (ctrc as CheckBoxList).SelectedItem.ToString() + "|";
}
}
}
resp = resp + (string.IsNullOrEmpty(resp) ? "|||" : "") + sres;
}
}
没有插入数据。并没有给我任何错误。任何建议欣赏
谢谢