Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Form control does not have ControlMode set ERROR MESSAGE

  Asked By: Traci    Date: Mar 06    Category: MOSS    Views: 13358

I got "Form control does not have ControlMode set" error
message when adding my custom web part in a subsite in MOSS 2007,
not sure what is wrong with my code, here's a code nippet of my web
part:

protected override void CreateChildControls()
{
button = new Button();
button.Text = "Search Employee";
button.Click += new EventHandler(button_Click);
Controls.Add(button);

ssnField = new TextField();
ssnField.ControlMode = SPControlMode.New;
Controls.Add(ssnField);

searchCriteriaLabel = new Label();
searchCriteriaLabel.Text = "Search Criteria";
Controls.Add(searchCriteriaLabel);

ssnLabel = new Label();
ssnLabel.Text = "Social Security Number: ";
Controls.Add(ssnLabel);
}

//Render web part to the web browser
protected override void RenderContents(HtmlTextWriter writer)
{
//Display data
writer.Write("<table border=\"0\" width=\"100%\">");

writer.Write("<tr><td>");
searchCriteriaLabel.RenderControl(writer);
writer.Write("</td></tr>");

writer.Write("<tr><td>");
ssnLabel.RenderControl(writer);
writer.Write("</td></tr>");

writer.Write("<tr><td>");
ssnField.RenderControl(writer);
writer.Write("</td></tr>");

writer.Write("<tr><td>");
writer.Write("</td></tr>");

writer.Write("<tr><td>");
button.RenderControl(writer);
writer.Write("</td></tr>");

writer.Write("</table>");
}

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Juan Manrique     Answered On: Feb 09

Check this


letrasandnumeros.com/.../


You must define the formMode

 
Didn't find what you were looking for? Find more on Form control does not have ControlMode set ERROR MESSAGE Or get search suggestion and latest updates.

Related Topics:



Tagged:            

 
 
 
 

Related Post