Learn how to a build a cloud-first strategyRegister Now


Conversion from string "__Page" to type 'Integer' is not valid.

Posted on 2011-10-14
Medium Priority
Last Modified: 2012-08-13
I have a detailsview that I am pulling as a parameter, but it appears to be pulling the wrong information
Protected Sub btnInsertNewException_Click(sender As Object, e As EventArgs) Handles btnInsertNewException.Click
        Dim cnn As New System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("myprovalConnectionString").ConnectionString)
            Dim cmd As New System.Data.SqlClient.SqlCommand
            cmd.Connection = cnn
            cmd.CommandType = Data.CommandType.StoredProcedure
            cmd.CommandText = "dbo.ClientReportExceptionInsert"
            cmd.Parameters.Add("@ReportTypeID ", Data.SqlDbType.Int).Value = Int32.Parse(txtReportTypeID.SelectedItem.Value)
            cmd.Parameters.Add("@ExceptionFee ", Data.SqlDbType.Char).Value = txtExceptionFee.Text
            cmd.Parameters.Add("@ExceptionTurnTime ", Data.SqlDbType.Char).Value = txtExceptionTurnTime.Text
            cmd.Parameters.Add("@ClientID ", Data.SqlDbType.Int).Value = CInt(ClientID)
            cmd.Parameters.Add("@UserKey", Data.SqlDbType.Int).Value = 1
            Dim dr As Data.SqlClient.SqlDataReader = cmd.ExecuteReader
        End Try
    End Sub

Open in new window

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server">
    <asp:ControlParameter  ControlID="dtlClients" Name="ClientID" PropertyName="SelectedValue" />

Open in new window

Question by:rcowen00
  • 2
  • 2
LVL 36

Accepted Solution

Miguel Oz earned 2000 total points
ID: 36972185
What kind of control is dtlClients?

Just remember that ClientID can only be used for the object data source SelectMethod only, that is not shown here.
(see figure 8 and generated markup)

Author Comment

ID: 36974129
dtlClients is a detailview
LVL 36

Expert Comment

by:Miguel Oz
ID: 36974614
My previous comment stands. you can not use object data source without a SelectMethod.

Alternative: What you can do if Sub btnInsertNewException_Click is in the same page as dtlClients is to access directly (enabling view state) else you need to save the required value in Session object so other page can access it. You may need to open another question detailing markup of both detail view and target page.
LVL 83

Expert Comment

ID: 36976620
Did you try

cmd.Parameters.Add("@ClientID ", Data.SqlDbType.Int).Value = CInt(dtlClients.SelectedValue)

Author Comment

ID: 36976826
Code Cruser, I had tried that and it did not work.  Thank you.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 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