Hi All,
I have created dynamic textboxes in a panel and trying to save them into database as a XML file, but I am receiving an error like
Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControl'
Here is my piece of code which I have written
StringBuilder _StrResult = new StringBuilder();
_StrResult.Append("");
foreach (TextBox txt in pnlInterview.Controls)
{
foreach (Label lbl in pnlInterview.Controls)
{
Label lblLevel = (Label)pnlInterview.FindControl("lbl");
TextBox txtInterviewRound = (TextBox)pnlInterview.FindControl("txt");
_StrResult.Append("");
_StrResult.Append("" + lblLevel.Text.ToString() + " ");
_StrResult.Append("" + txtInterviewRound.Text.ToString() + " ");
_StrResult.Append("");
}
}
_StrResult.Append("");
return _StrResult;
Unable to recognize where it went wrong
I am unable to access oftype()
at starting foreach loop only I am receiving this error
any help is appreciated

Phani KumarPosted Mar 9, 2016, 1:44 AM
Abubakar DandotiPosted Mar 9, 2016, 1:05 AM
Phani KumarPosted Mar 7, 2016, 12:11 AM
Abubakar DandotiPosted Mar 6, 2016, 11:42 PM
Phani KumarPosted Mar 5, 2016, 6:13 AM
Abubakar DandotiPosted Mar 5, 2016, 5:40 AM
Ravi PatelPosted Mar 5, 2016, 5:39 AM
Phani KumarPosted Mar 5, 2016, 5:14 AM
Abubakar DandotiPosted Mar 5, 2016, 4:55 AM