Question on Details View

K

kamlesh

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?
 
M

Masudur

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top