Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InnerHTML and Validation problem

Status
Not open for further replies.

jermine

Programmer
Jun 15, 2001
59
SG
This is problem thats pretty tricky for me, but for the guru's here, i know this will be a piece of cake... I hope you guys can help a newbie like me.

Im using the div tag's contentEditable property for my simple rich text editing (bold, italize, underline, color pick and createLink).

Code for my div tag :
<div class="divClass" id="oComment" contentEditable="true" runat="server" name="oComment"></div>

Two things i need do.
1. Validate if this field has values
2. Submit the value to another page

For the validation, i thought i could use the requiredfield validator control, but .net returns an error.
" Control 'oQuestion' referenced by the ControlToValidate property of 'RequiredFieldValidator1' cannot be validated "

For the 2nd one,
private void btnSubmit_Click(object sender,System.EventArgs e)
{
Session["oCommentHTML"]=oComment.InnerText;
Server.Transfer("ValueChecker.aspx");
}

I hope anyone here can help me on this. i am all ears :)
 
What type of control is oQuestion? Not all controls can be validated. A div cannot be the ControlToValidate property of a RequiredFieldValidator. You could use a textarea instead of a div though and this would be ok to validate...

The second one looks fine to me. Bear in mind though that the contents of the Request.Form collection will be available in the page you transfer to anyway so you may not want to add the comment to the Session to persist it to the next page.

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top