Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Object datasource and Querystring roblem

Posted on 2006-07-09
6
Medium Priority
?
673 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
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
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 Ageil
ID: 17078318
Did it work after the change or got the same error?

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

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

Expert Comment

by:Sammy Ageil
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

885 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