Preset fields in detailsview.

Discussion in 'ASP .Net Web Controls' started by Alan Morris, Oct 8, 2006.

  1. Alan Morris

    Alan Morris Guest

    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
    Alan Morris, Oct 8, 2006
    #1
    1. Advertising

  2. Alan Morris

    Phil H Guest

    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)
    Phil H, Oct 14, 2006
    #2
    1. Advertising

  3. Alan Morris

    Phil H Guest

    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 H, Oct 14, 2006
    #3
  4. Alan Morris

    Alan Morris Guest

    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,


    On 13 Oct 2006 18:14:34 -0700, "Phil H" <> 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.
    Alan Morris, Oct 16, 2006
    #4
  5. Alan Morris

    Alan Morris Guest

    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.

    On 13 Oct 2006 18:14:34 -0700, "Phil H" <> 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.
    Alan Morris, Nov 23, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nugs
    Replies:
    1
    Views:
    133
    Marcio Kleemann
    May 26, 2004
  2. Feege
    Replies:
    0
    Views:
    436
    Feege
    Dec 20, 2005
  3. Michael
    Replies:
    2
    Views:
    116
  4. Peter Amberg
    Replies:
    13
    Views:
    173
    Thomas 'PointedEars' Lahn
    Apr 5, 2004
  5. murrayatuptowngallery

    mouseover image and object sound and preset volume level?

    murrayatuptowngallery, Nov 1, 2005, in forum: Javascript
    Replies:
    4
    Views:
    189
    Thomas 'PointedEars' Lahn
    Nov 1, 2005
Loading...

Share This Page