|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Preset fields in detailsview.I am trying to preset some values on a detailsview for inserting a
record. If I try:- DetailsView1.Rows(0).Cells(1).Text = "My text2" then the text looks like a label and is not editable - not in the textbox of the field concerned. Am I right in thinking I have to 'cast' the boundfield in some way. I am rather baffled by this. Any help appreciated. Alan Hi Alan
I don't know of any way to pre-enter them in the text boxes but if what you are trying to do is create some default values then you can specify them by configuring the INSERT command of the SqlDataSource. Use the Propeties window for the DataSource not the "Configure DataSource" wizard. You'll be able to link the parameters to the DetailsView control and specify default values. One way you could indicate default values to the user is to edit the Head text of the field something like this: First name (Fred) Last name (Blogs) Hi Again Alan
A further thought. You might consider using a FormView rather than a DetailsView for entering new records. Its all based on templates and you'll have more control over the appearance in different modes. Phil,
Thanks your reply, what I am trying to do is create a data entry form, where certain fields will be common from one record to the next. Thus to save the user retyping everything I was planning to catch the relevant fields from the previous submit and use these values to populate the form. Hope that makes sense. Regards, Show quoteHide quote On 13 Oct 2006 18:14:34 -0700, "Phil H" <goo***@philhall.net> wrote: >Hi Again Alan > >A further thought. You might consider using a FormView rather than a >DetailsView for entering new records. Its all based on templates and >you'll have more control over the appearance in different modes. Phil,
Thanks your further reply, I researched your idea of a FormView and came up with some suggestions on the web of how to achieve what I wanted with such. I was then able to apply these to the details view in the following way:- I converted the relevant fiellds of the DetailsView to Template items and then set the value of each of these as follows:- DirectCast(Me.DetailsView1.FindControl("TextBox1"), TextBox).Text = expression. Thanks again. Show quoteHide quote On 13 Oct 2006 18:14:34 -0700, "Phil H" <goo***@philhall.net> wrote: >Hi Again Alan > >A further thought. You might consider using a FormView rather than a >DetailsView for entering new records. Its all based on templates and >you'll have more control over the appearance in different modes.
HTML can't find Caption property for datagrid
Nested Child Control Events Not Firing gridview databinding to object data source How can I alter the datatype of the data quiry from a database and store it into a gridview? Paging In GridView bound to DataSet Custom Image Button help. problem with refresh page on back button Configure webcontrol properties through Web.Config? DataFormatString Date building CMS |
|||||||||||||||||||||||