I need a message board for one of my current projects. The user should only see text boxes for the message title and the body. However, the table that the user is writing to has seven properties. The ID is being added just fine, but the other four are being weird.
When I set the field visible properties to True and leave the fields blank, the code adds everything just fine. But I want them False... and when I do that, they don't set anything. Any solutions?
Here's the code that adds the information.
vb Code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim txtDate As TextBox = DetailsView1.FindControl("TextBox6") txtDate.Text = System.DateTime.Now Dim txtPostedBy As TextBox = DetailsView1.FindControl("TextBox2") txtPostedBy.Text = Membership.GetUser.UserName.ToString Dim txtMod As TextBox = DetailsView1.FindControl("TextBox3") txtMod.Text = System.DateTime.Now Dim txtModBy As TextBox = DetailsView1.FindControl("TextBox1") txtModBy.Text = Membership.GetUser.UserName.ToString DetailsView1.InsertItem(False) Response.Redirect("~/msgboard.aspx") End Sub




Reply With Quote