Loading a value on the insert command of a detailsview
<p>In a detailsview, how can I prepopulate one of the textboxes on the insertcommand (When the user clicks insert and the view is insert).</p>

<p>I think this would work for codebehind:</p>

<p>Dim txtBox As TextBox = FormView1.FindControl("txtbox")</p>

<p>txtbox.Text = "Whatever I want"</p>

<p>Is this right? What do I need in the aspx (not as sure)? Also, I'm assuming the server-side code will go in the itemcommand or insertcreating event.</p>

<p>I have typed this in VB.NET but I am using C# (I can do both so on a language agnostic forum I might type the problem in another language). I am also using a SqlDataSource, with my parameters and insert/delete/edit commands all created.</p>

<p>I am trying to generate a random GUID (using the GUID object), which will be prepopulated in the textbox.</p>

<p>Also, is the postbackurl property of a button not another way of preserving form state?</p>

<p>Thanks</p>
