Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ObjectDataSource ControlParameters

Reply
Thread Tools

ObjectDataSource ControlParameters

 
 
jeremy.brewster@akqa.com
Guest
Posts: n/a
 
      07-05-2006
Hello

I have an ObjectDataSource object on a webform, and the
ObjectDataSource object includes a series of asp:ControlParameter
object as SelectParameters. Some of these ControlParameter object
refer to drop-down lists and some refer to asp:TextBoxes.

My problem is that to be able to use an existing business layer object,
I want to be able to pass zero-length strings for each asp:TextBox that
is left empty. These values keep being passed as nulls. Is there any
way to intercept each TextBox value and set the value to String.Empty
if the TextBox is empty? I've tried intercepting the values in the
Select event but I cannot override the value from there.

<aspbjectdatasource id="ObjectDataSource1" runat="server"
typename="Business.UserManager" selectmethod="FindUserSearch"
onselecting="ObjectDataSource1_Selecting"
oninit="ObjectDataSource1_Init">
<selectparameters>
<asp:controlparameter name="membershipNumber" type="Int32"
controlid="MembershipNumberTextBox" propertyname="Text" />
<asp:controlparameter name="userSecurityRoleId" type="String"
controlid="SecurityRoleDropDownListControl1"
propertyname="SelectedValue" />
<asp:controlparameter name="firstName" type="String"
controlid="FirstNameTextBox" propertyname="Text" />
<asp:controlparameter name="surname" type="String"
controlid="SurnameTextBox" propertyname="Text" />
<asp:controlparameter name="email" type="String"
controlid="EmailTextBox" propertyname="Text" />
<asp:controlparameter name="postcode" type="String"
controlid="EmailTextBox" propertyname="Text" />
<asp:controlparameter name="isActive" type="Boolean"
controlid="StatusDropDownList" propertyname="SelectedValue" />
</selectparameters>
</aspbjectdatasource>

 
Reply With Quote
 
 
 
 
CaffieneRush@gmail.com
Guest
Posts: n/a
 
      07-05-2006
Have you tried setting ConvertEmptyStringToNull within parameter to
false explicitly?

<asp:ControlParameter ConvertEmptyStringToNull="false" Type="String"
ControlID="txtFullName" PropertyName="Text" />

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hello
>
> I have an ObjectDataSource object on a webform, and the
> ObjectDataSource object includes a series of asp:ControlParameter
> object as SelectParameters. Some of these ControlParameter object
> refer to drop-down lists and some refer to asp:TextBoxes.
>
> My problem is that to be able to use an existing business layer object,
> I want to be able to pass zero-length strings for each asp:TextBox that
> is left empty. These values keep being passed as nulls. Is there any
> way to intercept each TextBox value and set the value to String.Empty
> if the TextBox is empty? I've tried intercepting the values in the
> Select event but I cannot override the value from there.
>
> <aspbjectdatasource id="ObjectDataSource1" runat="server"
> typename="Business.UserManager" selectmethod="FindUserSearch"
> onselecting="ObjectDataSource1_Selecting"
> oninit="ObjectDataSource1_Init">
> <selectparameters>
> <asp:controlparameter name="membershipNumber" type="Int32"
> controlid="MembershipNumberTextBox" propertyname="Text" />
> <asp:controlparameter name="userSecurityRoleId" type="String"
> controlid="SecurityRoleDropDownListControl1"
> propertyname="SelectedValue" />
> <asp:controlparameter name="firstName" type="String"
> controlid="FirstNameTextBox" propertyname="Text" />
> <asp:controlparameter name="surname" type="String"
> controlid="SurnameTextBox" propertyname="Text" />
> <asp:controlparameter name="email" type="String"
> controlid="EmailTextBox" propertyname="Text" />
> <asp:controlparameter name="postcode" type="String"
> controlid="EmailTextBox" propertyname="Text" />
> <asp:controlparameter name="isActive" type="Boolean"
> controlid="StatusDropDownList" propertyname="SelectedValue" />
> </selectparameters>
> </aspbjectdatasource>


 
Reply With Quote
 
 
 
 
jeremy.brewster@akqa.com
Guest
Posts: n/a
 
      07-06-2006
Hi

Yes, I tried that yesterday evening and everything now works. I hadn't
stumbled across this property until I created a test object data source
using the designer and saw the interactive means of setting
ConvertEmptyStringToNull.

Thanks

Jez


(E-Mail Removed) wrote:
> Have you tried setting ConvertEmptyStringToNull within parameter to
> false explicitly?
>
> <asp:ControlParameter ConvertEmptyStringToNull="false" Type="String"
> ControlID="txtFullName" PropertyName="Text" />
>
> (E-Mail Removed) wrote:
> > Hello
> >
> > I have an ObjectDataSource object on a webform, and the
> > ObjectDataSource object includes a series of asp:ControlParameter
> > object as SelectParameters. Some of these ControlParameter object
> > refer to drop-down lists and some refer to asp:TextBoxes.
> >
> > My problem is that to be able to use an existing business layer object,
> > I want to be able to pass zero-length strings for each asp:TextBox that
> > is left empty. These values keep being passed as nulls. Is there any
> > way to intercept each TextBox value and set the value to String.Empty
> > if the TextBox is empty? I've tried intercepting the values in the
> > Select event but I cannot override the value from there.
> >
> > <aspbjectdatasource id="ObjectDataSource1" runat="server"
> > typename="Business.UserManager" selectmethod="FindUserSearch"
> > onselecting="ObjectDataSource1_Selecting"
> > oninit="ObjectDataSource1_Init">
> > <selectparameters>
> > <asp:controlparameter name="membershipNumber" type="Int32"
> > controlid="MembershipNumberTextBox" propertyname="Text" />
> > <asp:controlparameter name="userSecurityRoleId" type="String"
> > controlid="SecurityRoleDropDownListControl1"
> > propertyname="SelectedValue" />
> > <asp:controlparameter name="firstName" type="String"
> > controlid="FirstNameTextBox" propertyname="Text" />
> > <asp:controlparameter name="surname" type="String"
> > controlid="SurnameTextBox" propertyname="Text" />
> > <asp:controlparameter name="email" type="String"
> > controlid="EmailTextBox" propertyname="Text" />
> > <asp:controlparameter name="postcode" type="String"
> > controlid="EmailTextBox" propertyname="Text" />
> > <asp:controlparameter name="isActive" type="Boolean"
> > controlid="StatusDropDownList" propertyname="SelectedValue" />
> > </selectparameters>
> > </aspbjectdatasource>


 
Reply With Quote
 
CaffieneRush@gmail.com
Guest
Posts: n/a
 
      07-06-2006
You're welcome.
I don't use that attribute myself but handle nulls seperately in my
DAL.

Andy

(E-Mail Removed) wrote:
> Hi
>
> Yes, I tried that yesterday evening and everything now works. I hadn't
> stumbled across this property until I created a test object data source
> using the designer and saw the interactive means of setting
> ConvertEmptyStringToNull.
>
> Thanks
>
> Jez
>
>
> (E-Mail Removed) wrote:
> > Have you tried setting ConvertEmptyStringToNull within parameter to
> > false explicitly?
> >
> > <asp:ControlParameter ConvertEmptyStringToNull="false" Type="String"
> > ControlID="txtFullName" PropertyName="Text" />
> >
> > (E-Mail Removed) wrote:
> > > Hello
> > >
> > > I have an ObjectDataSource object on a webform, and the
> > > ObjectDataSource object includes a series of asp:ControlParameter
> > > object as SelectParameters. Some of these ControlParameter object
> > > refer to drop-down lists and some refer to asp:TextBoxes.
> > >
> > > My problem is that to be able to use an existing business layer object,
> > > I want to be able to pass zero-length strings for each asp:TextBox that
> > > is left empty. These values keep being passed as nulls. Is there any
> > > way to intercept each TextBox value and set the value to String.Empty
> > > if the TextBox is empty? I've tried intercepting the values in the
> > > Select event but I cannot override the value from there.
> > >
> > > <aspbjectdatasource id="ObjectDataSource1" runat="server"
> > > typename="Business.UserManager" selectmethod="FindUserSearch"
> > > onselecting="ObjectDataSource1_Selecting"
> > > oninit="ObjectDataSource1_Init">
> > > <selectparameters>
> > > <asp:controlparameter name="membershipNumber" type="Int32"
> > > controlid="MembershipNumberTextBox" propertyname="Text" />
> > > <asp:controlparameter name="userSecurityRoleId" type="String"
> > > controlid="SecurityRoleDropDownListControl1"
> > > propertyname="SelectedValue" />
> > > <asp:controlparameter name="firstName" type="String"
> > > controlid="FirstNameTextBox" propertyname="Text" />
> > > <asp:controlparameter name="surname" type="String"
> > > controlid="SurnameTextBox" propertyname="Text" />
> > > <asp:controlparameter name="email" type="String"
> > > controlid="EmailTextBox" propertyname="Text" />
> > > <asp:controlparameter name="postcode" type="String"
> > > controlid="EmailTextBox" propertyname="Text" />
> > > <asp:controlparameter name="isActive" type="Boolean"
> > > controlid="StatusDropDownList" propertyname="SelectedValue" />
> > > </selectparameters>
> > > </aspbjectdatasource>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource method as another ObjectDataSource David Thielen ASP .Net Web Controls 3 03-23-2006 01:50 AM
HELP !!! ObjectDataSource Delete Parameter Problem ASP.NET 2.0 Microsoft news ASP .Net 2 03-16-2005 05:37 PM
ObjectDataSource =?Utf-8?B?RG9u?= ASP .Net 0 11-22-2004 08:21 PM
Arrrrg !!!! ObjectDataSource Issues WertmanTheMad ASP .Net 2 10-08-2004 04:10 PM
objectDataSource WertmanTheMad ASP .Net 0 09-15-2004 03:37 AM



Advertisments