Solved

Object datasource and Querystring roblem

Posted on 2006-07-09
6
659 Views
Last Modified: 2008-02-01
Hello experts,

I am having trouble assigning a querystring value to a business object parameter.when I do the following;-

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetGalleryImagesByID"
                TypeName="FixedAuctions.AuctionsDB">
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="-1" Name="GalleryID" QueryStringField="GALLERYID"
                        Type="Int32" />
                </SelectParameters>
            </asp:ObjectDataSource>
I get error;-



Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753603
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
   System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
   System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
   System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264
   System.Web.UI.WebControls.Parameter.get_ParameterValue() +66
   System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +254
   System.Web.UI.WebControls.ObjectDataSourceView
 


I f I change the follwoing line;-

<asp:QueryStringParameter DefaultValue="-1" Name="GalleryID" QueryStringField="GALLERYID"
                        Type="Int32" />


to-
<asp:QueryStringParameter DefaultValue="1" Name="GalleryID"
                        Type="Int32" />

everything works fine.

I am using the code in a popup that is called in a javascript function like so;-

HyperLink HyperLink1 = (HyperLink)DataList1.Items[i].FindControl("HyperLink1");
                HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx?IMAGEID=IMAGEID',null,'height=550, width=650,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');");

I can't seem to find what am missing
0
Comment
Question by:claracruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:Sammy
ID: 17071406
without looking deeper into your code, you have
<asp:QueryStringParameter DefaultValue="-1" Name="GalleryID" QueryStringField="GALLERYID" Type="Int32" />
and your link doesnt have a querystring GALLERYID, instead it has a Querystring IMAGEID

0
 
LVL 4

Author Comment

by:claracruz
ID: 17075176
Hi there,

I had to change this;-


HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx?IMAGEID=IMAGEID',null,'height=550, width=650,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');");
to

 HyperLink1.Attributes.Add("onclick", "window.open('popup.aspx?IMAGEID="+IMAGEID+",null,'height=550, width=650,status= no, resizable= no, scrollbars=no,

IE.
IMAGEID=IMAGEID'

to

IMAGEID="+IMAGEID+",
0
 
LVL 27

Expert Comment

by:Sammy
ID: 17078318
Did it work after the change or got the same error?

0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 4

Author Comment

by:claracruz
ID: 17088099
problem solved with above change
0
 
LVL 27

Expert Comment

by:Sammy
ID: 17088150
Great, close the question please.
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17259871
Closed, 250 points refunded.
Netminder
Site Admin
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question