Hello all, and thank you in advance for any feedback/help you might post.
I need help getting a web page element id out of a string variable to be used within my c# code behind page.
I am trying to display a string in a literal control telling the user what was wrong with the input that they provided in the associated text box. my error string looks like this:
[code=cpp]
errorMsg = "litLastNam e-Please enter a valid last name"
[/code]
I already have the string split and placed into two variables. this happens in a for loop.
here is my code thus far in C#:
[code=cpp]
{
string errorMsg = hdnErrorMsg.Val ue;
litResults.Text = errorMsg;
//breaks up the mass error string into individual error strings
string[] errorMsgSplit = errorMsg.Split( '/');
string strLitErrorElem ent = "";
string strLitErrorMsg = "";
for (int i = 1; i < errorMsgSplit.L ength; i++)
{
strLitErrorMsg = strLitErrorMsg + errorMsgSplit[i];
litResults.Text = strLitErrorMsg;
//splits the individual error strings into the asp lit and lit text
string[] indErrorMsg = errorMsgSplit[i].Split('-');
strLitErrorElem ent = indErrorMsg[0];
strLitErrorMsg = indErrorMsg[1];
(here is the part where I'm stuck)
}
}
[/code]
basically i need to get the stuff out of strLitErrorElem ent out so I can use it like this:
[code=cpp]
litLastName.tex t = "Please enter a valid Last Name"
[/code]
Again, thank you ahead of time for your positive input, help, and/or examples :)
I need help getting a web page element id out of a string variable to be used within my c# code behind page.
I am trying to display a string in a literal control telling the user what was wrong with the input that they provided in the associated text box. my error string looks like this:
[code=cpp]
errorMsg = "litLastNam e-Please enter a valid last name"
[/code]
I already have the string split and placed into two variables. this happens in a for loop.
here is my code thus far in C#:
[code=cpp]
{
string errorMsg = hdnErrorMsg.Val ue;
litResults.Text = errorMsg;
//breaks up the mass error string into individual error strings
string[] errorMsgSplit = errorMsg.Split( '/');
string strLitErrorElem ent = "";
string strLitErrorMsg = "";
for (int i = 1; i < errorMsgSplit.L ength; i++)
{
strLitErrorMsg = strLitErrorMsg + errorMsgSplit[i];
litResults.Text = strLitErrorMsg;
//splits the individual error strings into the asp lit and lit text
string[] indErrorMsg = errorMsgSplit[i].Split('-');
strLitErrorElem ent = indErrorMsg[0];
strLitErrorMsg = indErrorMsg[1];
(here is the part where I'm stuck)
}
}
[/code]
basically i need to get the stuff out of strLitErrorElem ent out so I can use it like this:
[code=cpp]
litLastName.tex t = "Please enter a valid Last Name"
[/code]
Again, thank you ahead of time for your positive input, help, and/or examples :)
Comment