Home All Groups Group Topic Archive Search About
Author
8 Oct 2006 9:56 PM
Alan Morris
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

Author
14 Oct 2006 12:37 AM
Phil H
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)
Author
14 Oct 2006 1:14 AM
Phil H
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.
Author
16 Oct 2006 3:30 PM
Alan Morris
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.
Author
23 Nov 2006 12:46 PM
Alan Morris
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.