473,851 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

handling Radio buttons in Formview with ObjectDataSourc e

What is the best way to handle data interpolation between form controls and
the actual sql data field. I have radio buttons that need to be interpreted,
form values that have to be translated.. e.g.

if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
myObjectInstanc e.CommuteMethod = sb.ToString();

Should this be done in an event method generated by the update command or in
the update method of the business object... not sure how to proceed when
using ObjectDataSourc e.

Thanks for any advice.
Apr 13 '06 #1
5 1929
Your question is a bit ambiguous. What exactly is the method named
"myObjectInstan ce.CommuteMetho d" doing? You are passing it a string that you
composed from the values entered on some controls but then what does that
string do?

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
What is the best way to handle data interpolation between form controls and
the actual sql data field. I have radio buttons that need to be interpreted,
form values that have to be translated.. e.g.

if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
myObjectInstanc e.CommuteMethod = sb.ToString();

Should this be done in an event method generated by the update command or in
the update method of the business object... not sure how to proceed when
using ObjectDataSourc e.

Thanks for any advice.

Apr 13 '06 #2
Sorry ;) CommuteMethod is actually method of commuting, not a function. It is
a property in a data object object RegistrantDetai ls which can be inserted
into my database with update method in business object RegistrantDB.
<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" DataObjectTypeN ame="Registrant Details"
UpdateMethod="U pdateRegistrant " >

Thanks.

"Phillip Williams" wrote:
Your question is a bit ambiguous. What exactly is the method named
"myObjectInstan ce.CommuteMetho d" doing? You are passing it a string that you
composed from the values entered on some controls but then what does that
string do?

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
What is the best way to handle data interpolation between form controls and
the actual sql data field. I have radio buttons that need to be interpreted,
form values that have to be translated.. e.g.

if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
myObjectInstanc e.CommuteMethod = sb.ToString();

Should this be done in an event method generated by the update command or in
the update method of the business object... not sure how to proceed when
using ObjectDataSourc e.

Thanks for any advice.

Apr 13 '06 #3
Ok, that removes one part of the mystery; the other part is the “Radio
buttons” (which appears as the subject of this thread) relationship to the
posted code (which seems to be attempting to compose a string from textbox
values but has no radio buttons in it).

Are you asking “how to databind a property to the values of 3 or more
controls (including radio buttons)?”

If it turns out to be the case, then I would split that one field (named
CommuteMethod) into 3 different public properties (tbDaysDriveAlo ne,
tbDaysVanPool, tbDaysCarpool ) that are bound separately to each control.
Then during the update method I would concatenate the three into the
parameter that you need to pass through to the actual query.

This would allow you to expose a bool property that can be bound easily to
the radiobuttonlist but then you would translate it to a string when you
concatenate the 3 properties.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
Sorry ;) CommuteMethod is actually method of commuting, not a function. It is
a property in a data object object RegistrantDetai ls which can be inserted
into my database with update method in business object RegistrantDB.
<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" DataObjectTypeN ame="Registrant Details"
UpdateMethod="U pdateRegistrant " >

Thanks.

"Phillip Williams" wrote:
Your question is a bit ambiguous. What exactly is the method named
"myObjectInstan ce.CommuteMetho d" doing? You are passing it a string that you
composed from the values entered on some controls but then what does that
string do?

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
What is the best way to handle data interpolation between form controls and
the actual sql data field. I have radio buttons that need to be interpreted,
form values that have to be translated.. e.g.

if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
myObjectInstanc e.CommuteMethod = sb.ToString();

Should this be done in an event method generated by the update command or in
the update method of the business object... not sure how to proceed when
using ObjectDataSourc e.

Thanks for any advice.

Apr 13 '06 #4
Ok I think you're saying, have a public property in the dataobject class for
each element in the form instead of just having properties for the sql data
elements I'm trying to store. Is that right?

(The radio buttons were just a second example, the stringbuilder example was
a bunch of checkboxes. I like the way you produced a combed solution ;)

I wouldn't have thought along these lines, I would more likely have
retreated back to the old style dataset coding with manual mapping of
textboxes to dataset fields (ughhh with 50+ fields). Thanks for the tip!!

"Phillip Williams" wrote:
Ok, that removes one part of the mystery; the other part is the “Radio
buttons” (which appears as the subject of this thread) relationship to the
posted code (which seems to be attempting to compose a string from textbox
values but has no radio buttons in it).

Are you asking “how to databind a property to the values of 3 or more
controls (including radio buttons)?”

If it turns out to be the case, then I would split that one field (named
CommuteMethod) into 3 different public properties (tbDaysDriveAlo ne,
tbDaysVanPool, tbDaysCarpool ) that are bound separately to each control.
Then during the update method I would concatenate the three into the
parameter that you need to pass through to the actual query.

This would allow you to expose a bool property that can be bound easily to
the radiobuttonlist but then you would translate it to a string when you
concatenate the 3 properties.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
Sorry ;) CommuteMethod is actually method of commuting, not a function. It is
a property in a data object object RegistrantDetai ls which can be inserted
into my database with update method in business object RegistrantDB.
<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" DataObjectTypeN ame="Registrant Details"
UpdateMethod="U pdateRegistrant " >

Thanks.

"Phillip Williams" wrote:
Your question is a bit ambiguous. What exactly is the method named
"myObjectInstan ce.CommuteMetho d" doing? You are passing it a string that you
composed from the values entered on some controls but then what does that
string do?

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:

> What is the best way to handle data interpolation between form controls and
> the actual sql data field. I have radio buttons that need to be interpreted,
> form values that have to be translated.. e.g.
>
> if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
> if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
> if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
> myObjectInstanc e.CommuteMethod = sb.ToString();
>
> Should this be done in an event method generated by the update command or in
> the update method of the business object... not sure how to proceed when
> using ObjectDataSourc e.
>
> Thanks for any advice.

Apr 13 '06 #5

"Dabbler" wrote:
Ok I think you're saying, have a public property in the dataobject class for
each element in the form instead of just having properties for the sql data
elements I'm trying to store. Is that right?
Yes.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
(The radio buttons were just a second example, the stringbuilder example was
a bunch of checkboxes. I like the way you produced a combed solution ;)

I wouldn't have thought along these lines, I would more likely have
retreated back to the old style dataset coding with manual mapping of
textboxes to dataset fields (ughhh with 50+ fields). Thanks for the tip!!

"Phillip Williams" wrote:
Ok, that removes one part of the mystery; the other part is the “Radio
buttons” (which appears as the subject of this thread) relationship to the
posted code (which seems to be attempting to compose a string from textbox
values but has no radio buttons in it).

Are you asking “how to databind a property to the values of 3 or more
controls (including radio buttons)?”

If it turns out to be the case, then I would split that one field (named
CommuteMethod) into 3 different public properties (tbDaysDriveAlo ne,
tbDaysVanPool, tbDaysCarpool ) that are bound separately to each control.
Then during the update method I would concatenate the three into the
parameter that you need to pass through to the actual query.

This would allow you to expose a bool property that can be bound easily to
the radiobuttonlist but then you would translate it to a string when you
concatenate the 3 properties.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dabbler" wrote:
Sorry ;) CommuteMethod is actually method of commuting, not a function. It is
a property in a data object object RegistrantDetai ls which can be inserted
into my database with update method in business object RegistrantDB.
<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" DataObjectTypeN ame="Registrant Details"
UpdateMethod="U pdateRegistrant " >

Thanks.

"Phillip Williams" wrote:

> Your question is a bit ambiguous. What exactly is the method named
> "myObjectInstan ce.CommuteMetho d" doing? You are passing it a string that you
> composed from the values entered on some controls but then what does that
> string do?
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "Dabbler" wrote:
>
> > What is the best way to handle data interpolation between form controls and
> > the actual sql data field. I have radio buttons that need to be interpreted,
> > form values that have to be translated.. e.g.
> >
> > if (tbDaysDriveAlo ne.Text > 0) sb.Append( @"drive\");
> > if (tbDaysVanPool. Text > 0) sb.Append(@"van Pool\");
> > if (tbDaysCarpool > 0) sb.Append(@"Car pool\");
> > myObjectInstanc e.CommuteMethod = sb.ToString();
> >
> > Should this be done in an event method generated by the update command or in
> > the update method of the business object... not sure how to proceed when
> > using ObjectDataSourc e.
> >
> > Thanks for any advice.

Apr 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3677
by: Howard | last post by:
I use FormView and ObjectDataSource to take user inputs in adduser.aspx page i have <asp:ObjectDataSource ID="ds1" runat="server" TypeName="datapage" InsertMethod="addstudent"> and in my app_code foler i have a method that looks like public static void addstudent(...) { try {
0
2184
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
4754
by: ThePurpleCat | last post by:
Hi, I'm a newbie to ASP.NET programming but not to Visual Studio. I'm having trouble getting my Master-Details page to work. I have a page enabled GridView which is linked to a FormView control through an objectdatasource. The paging on my GridView works fine except that when I change the page the FormView does not update. I tried setting the selectedindex to 0 in the GridView's PageIndexChanged event and manually binding the formview...
1
6573
by: Pao | last post by:
I have a formview bounded to an objectdatasource. All ok but I have some trouble with a checkbox: when I am in update mode and I update the record, this field is never updated (no errors thrown). The field bounded in the database (MySql) is a string field (ENUM('True','False') default 'False'. The checkbox is correctly bounded in the itemtemplate and in the edititemtemplate.
0
2003
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= | last post by:
Hello, I read some msdn and other articles about how does databinding among DataSource controls and FormView / GridView controls works but I still don't fully understand to this blackbox. I have few questions and hopefully you can provide me some answers. 1. Best place for DataBinding. Where is the best place for calling DataBind method? Is it possible to say don't bind controls for this postback and use current values instead? These...
6
7353
by: Chris | last post by:
I want do my insert to a database using a formview bound to an objectdatasource. I also want to upload a file. I'm quite new to and this is just test code but Is there any way I can pass the file as a byte array and manipulate it in my business object. Currently what I have is this, but my byte array in my business object is nothing. It's like it's not passed the file as a stream. I think I am not binding the FileUpload to the...
5
4684
by: =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post by:
Hi All, I have a GridView inside the EditItemTemplate of a FormView. Both FormView and GridView are data bound using an ObjectDataSource. When the FormView's ObjectDataSource object has a SelectParameters with a SessionParameter in the parameters collection and the object stored in the Session is a reference type, the DataGrid fails to enter Line Editing mode. Is this a bug? Is there a workaround for this problem?
2
2066
by: JimS | last post by:
I am using DotNet 2.0 and Visual Studio 2005. The project is a web project. I am currently using an ObjectDataSource to populate a datagrid. The ObjectDataSource is configured to a function in a class to populate the initial load of data. I would like to use a Radio Button list to change the data viewed in the Grid. What is the best practice to perform this task. Is it better to have a default value for the Radio Buttons and have the...
0
1013
by: JimS | last post by:
I am using DotNet 2.0 and Visual Studio 2005. The project is a web project. I am currently using an ObjectDataSource to populate a datagrid. The ObjectDataSource is configured to a function in a class to populate the initial load of data. I would like to use a Radio Button list to change the data viewed in the Grid. What is the best practice to perform this task. Is it better to have a default value for the Radio Buttons and have the...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9744
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10725
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7900
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4142
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3178
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.