Question on Details View

Discussion in 'ASP .Net Web Controls' started by kamlesh, Jun 7, 2007.

  1. kamlesh

    kamlesh Guest

    Hi All,

    I have a question on the ASP.NET 2.0 Details view control

    I dont like using the SQLDataSource to bind the data to the
    DetailsView control..
    I dont like the idea of placing Queries in the .ASPX files...I
    prefer a 3 tiered approach to
    development.

    Am using a Custom object to bind the object to the Details View
    control at run time..
    When the page loads....like this

    BO.TestBO bo = new BO.TestBO();
    CustomObject object = bo.GetProfileInformation(1);

    this.personalInfoDetailsView.AllowPaging = false;
    this.interestInfoDetailsView.AllowPaging = false;

    this.personalInfoDetailsView.DataSource = object;
    this.personalInfoDetailsView.DataBind();

    This is the Details view control...
    <asp:DetailsView CellPadding="1" Font-Names="Verdana" Width="100%">
    <Fields>
    <asp:BoundField DataField="name" ReadOnly="True"
    SortExpression="name" />
    <asp:CheckBoxField DataField="gender"
    SortExpression="gender" />
    <asp:BoundField DataField="interests"
    ReadOnly="True"

    SortExpression="interests" />
    <asp:CommandField ShowEditButton="True" />
    </Fields>
    </asp:DetailsView>

    So here the custom object has three properties
    name ---> contains a name
    gender ---> boolean value
    interests --> This contains a comma separated string (Example:
    music,movies, cycling, tennis)

    So during Display mode.... the 'interests' field shows the comma
    separated values.

    But during edit mode, a text box appears in its place and the comma
    separated values are populated for editing purpose...

    Now when user goes into edit mode ....i want each value of the comma
    separated string as a separate check box...so that the user can select
    the options..

    Is this possible?
    What special code is to be written?
     
    kamlesh, Jun 7, 2007
    #1
    1. Advertising

  2. kamlesh

    Masudur Guest

    On Jun 8, 12:23 am, kamlesh <> wrote:
    > Hi All,
    >
    > I have a question on the ASP.NET 2.0 Details view control
    >
    > I dont like using the SQLDataSource to bind the data to the
    > DetailsView control..
    > I dont like the idea of placing Queries in the .ASPX files...I
    > prefer a 3 tiered approach to
    > development.
    >
    > Am using a Custom object to bind the object to the Details View
    > control at run time..
    > When the page loads....like this
    >
    > BO.TestBO bo = new BO.TestBO();
    > CustomObject object = bo.GetProfileInformation(1);
    >
    > this.personalInfoDetailsView.AllowPaging = false;
    > this.interestInfoDetailsView.AllowPaging = false;
    >
    > this.personalInfoDetailsView.DataSource = object;
    > this.personalInfoDetailsView.DataBind();
    >
    > This is the Details view control...
    > <asp:DetailsView CellPadding="1" Font-Names="Verdana" Width="100%">
    > <Fields>
    > <asp:BoundField DataField="name" ReadOnly="True"
    > SortExpression="name" />
    > <asp:CheckBoxField DataField="gender"
    > SortExpression="gender" />
    > <asp:BoundField DataField="interests"
    > ReadOnly="True"
    >
    > SortExpression="interests" />
    > <asp:CommandField ShowEditButton="True" />
    > </Fields>
    > </asp:DetailsView>
    >
    > So here the custom object has three properties
    > name ---> contains a name
    > gender ---> boolean value
    > interests --> This contains a comma separated string (Example:
    > music,movies, cycling, tennis)
    >
    > So during Display mode.... the 'interests' field shows the comma
    > separated values.
    >
    > But during edit mode, a text box appears in its place and the comma
    > separated values are populated for editing purpose...
    >
    > Now when user goes into edit mode ....i want each value of the comma
    > separated string as a separate check box...so that the user can select
    > the options..
    >
    > Is this possible?
    > What special code is to be written?


    Hi...

    SqlDataSource and ObjectDataSouece of Asp.net 2.0 are two fine new
    feature ...
    and we did liked it very much... But it seems your requirement is a
    little bit different...
    Asp.net site have few very good article demonastrating working with
    data... and matches your need

    http://www.asp.net/learn/dataaccess/tutorial01cs.aspx?tabid=63
    http://www.asp.net/learn/dataaccess/tutorial02cs.aspx?tabid=63
    http://www.asp.net/learn/dataaccess/tutorial03cs.aspx?tabid=63

    Thanks
    Masudur
     
    Masudur, Jun 10, 2007
    #2
    1. Advertising

  3. kamlesh

    kamlesh Guest

    hey all,

    I got a solution for this...
    please refer this post..

    http://forums.asp.net/t/1120050.aspx


    On Jun 10, 2:59 am, Masudur <> wrote:
    > On Jun 8, 12:23 am, kamlesh <> wrote:
    >
    >
    >
    >
    >
    > > Hi All,

    >
    > > I have a question on the ASP.NET 2.0 Details view control

    >
    > > I dont like using the SQLDataSource to bind the data to the
    > > DetailsView control..
    > > I dont like the idea of placing Queries in the .ASPX files...I
    > > prefer a 3 tiered approach to
    > > development.

    >
    > > Am using a Custom object to bind the object to the Details View
    > > control at run time..
    > > When the page loads....like this

    >
    > > BO.TestBO bo = new BO.TestBO();
    > > CustomObject object = bo.GetProfileInformation(1);

    >
    > > this.personalInfoDetailsView.AllowPaging = false;
    > > this.interestInfoDetailsView.AllowPaging = false;

    >
    > > this.personalInfoDetailsView.DataSource = object;
    > > this.personalInfoDetailsView.DataBind();

    >
    > > This is the Details view control...
    > > <asp:DetailsView CellPadding="1" Font-Names="Verdana" Width="100%">
    > > <Fields>
    > > <asp:BoundField DataField="name" ReadOnly="True"
    > > SortExpression="name" />
    > > <asp:CheckBoxField DataField="gender"
    > > SortExpression="gender" />
    > > <asp:BoundField DataField="interests"
    > > ReadOnly="True"

    >
    > > SortExpression="interests" />
    > > <asp:CommandField ShowEditButton="True" />
    > > </Fields>
    > > </asp:DetailsView>

    >
    > > So here the custom object has three properties
    > > name ---> contains a name
    > > gender ---> boolean value
    > > interests --> This contains a comma separated string (Example:
    > > music,movies, cycling, tennis)

    >
    > > So during Display mode.... the 'interests' field shows the comma
    > > separated values.

    >
    > > But during edit mode, a text box appears in its place and the comma
    > > separated values are populated for editing purpose...

    >
    > > Now when user goes into edit mode ....i want each value of the comma
    > > separated string as a separate check box...so that the user can select
    > > the options..

    >
    > > Is this possible?
    > > What special code is to be written?

    >
    > Hi...
    >
    > SqlDataSource and ObjectDataSouece of Asp.net 2.0 are two fine new
    > feature ...
    > and we did liked it very much... But it seems your requirement is a
    > little bit different...
    > Asp.net site have few very good article demonastrating working with
    > data... and matches your need
    >
    > http://www.asp.net/learn/dataaccess...t/learn/dataaccess/tutorial03cs.aspx?tabid=63
    >
    > Thanks
    > Masudur- Hide quoted text -
    >
    > - Show quoted text -
     
    kamlesh, Jun 11, 2007
    #3
    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. Phillip Vong
    Replies:
    1
    Views:
    356
    Paul Zanbaka
    Feb 24, 2006
  2. =?Utf-8?B?Sm9l?=

    Show Details/Hide Details link button

    =?Utf-8?B?Sm9l?=, Mar 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    907
    dkode
    Mar 13, 2006
  3. kamlesh

    Question on Details View

    kamlesh, Jun 7, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    423
    kamlesh
    Jun 11, 2007
  4. randy.buchholz

    Nub Question - Details View Visibility

    randy.buchholz, Jan 7, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    321
    randy.buchholz
    Jan 8, 2008
  5. Parthiv Joshi
    Replies:
    1
    Views:
    691
    Samuel L Matzen
    Jul 6, 2004
Loading...

Share This Page