Compiler Error Message: BC30311: Value of type 'System.Web.UI.DataSourceSelectArguments' cannot be converted to 'Integer'.

 Hello, I'm wondering if someone can help me figure out why I'm receiving the above error message..."Compiler Error Message: BC30311: Value of type 'System.Web.UI.DataSourceSelectArguments' cannot be converted to 'Integer'."

 In visual web developer, the blue line is pointing out the variables args, on line 15.

  

1    Imports System.Data
2    Partial Class POS_so_Default
3        Inherits System.Web.UI.Page
4    
5        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
6            customer_info.Visible = True
7            cust_search_box.Visible = False
8            customer_header.Visible = True
9    
10           If Page.IsPostBack Then
11               'bind data to text boxes
12               Dim dv As New DataView
13               Dim args As DataSourceSelectArguments = New DataSourceSelectArguments()
14   
15               dv = CType(Me.SqlDataSource3.SelectCommand(args), DataView)
16               Dim dtable As DataTable = New DataTable
17               If dv.Count > 0 Then
18                   dtable = dv.ToTable
19                   co_name.Text = dtable.Rows(0).Item(1)
20               End If
21   
22           End If
23       End Sub
24   
25       Protected Sub co_name_srch_btn_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles co_name_srch_btn.Click
26           cust_search_box.Visible = True
27       End Sub
28   
29       Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
30           Select Case e.Row.RowType
31               Case System.Web.UI.WebControls.ListItemType.Item, System.Web.UI.WebControls.ListItemType.AlternatingItem
32                   Dim data As System.Data.DataRowView = DirectCast(e.Row.DataItem, System.Data.DataRowView)
33                   Dim HyperLink1 As System.Web.UI.WebControls.HyperLink = DirectCast(e.Row.FindControl("HyperLink1"), System.Web.UI.WebControls.HyperLink)
34   
35                   HyperLink1.Text = "select"
36                   HyperLink1.NavigateUrl = "default.aspx?custID=" & data.Item("co_id")
37   
38           End Select
39       End Sub
40   End Class
41   

  I don't understand what's wrong. there are not even any integers involved. I thought to change my structure of my database thats involved here and I had two fields that were of type int...but I changed them to nvarchar with no error...the asp.net is..

 

1    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="POS_so_Default" %>
2    
3    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4    
5    <html xmlns="http://www.w3.org/1999/xhtml">
6    <head runat="server">
7        <title>Untitled Page</title>
8    
9    <!-- style sheets -->
10   <link href="../global.css" rel="Stylesheet" type="text/css" />
11   <link href="../menu.css"rel="Stylesheet" type="text/css" />
12   
13   <script type="text/javascript" src="../dropdown.js"></script>
14   
15   </head>
16   <body>
17       <form id="form1" runat="server">
18       
19       <!-- topnav, where main navigation links and logout button is located -->
20           <dl class="dropdown">
21             <dt id="zero-ddheader" onmouseover="ddMenu('zero',1)" onmouseout="ddMenu('zero',-1)">home</dt>
22             <dd id="zero-ddcontent" onmouseover="cancelHide('zero')" onmouseout="ddMenu('zero',-1)">
23               <ul>
24                 <li><a href="home.aspx" class="underline">home</a></li>
25               </ul>
26             </dd>
27           </dl>
28           
29           <dl class="dropdown">
30   
31             <dt id="one-ddheader" onmouseover="ddMenu('one',1)" onmouseout="ddMenu('one',-1)">sales</dt>
32             <dd id="one-ddcontent" onmouseover="cancelHide('one')" onmouseout="ddMenu('one',-1)">
33               <ul>
34                 <li><a href="so/default.aspx" class="underline">sales order</a></li>
35                 <li><a href="#" class="underline">sales quotation</a></li>
36                 <li><a href="#" class="underline">generate invoice</a></li>
37               </ul>
38             </dd>
39           </dl>
40   
41           <dl class="dropdown">
42             <dt id="two-ddheader" onmouseover="ddMenu('two',1)" onmouseout="ddMenu('two',-1)">purchasing</dt>
43             <dd id="two-ddcontent" onmouseover="cancelHide('two')" onmouseout="ddMenu('two',-1)">
44               <ul>
45                 <li><a href="#" class="underline">purchase order</a></li>
46               </ul>
47             </dd>
48           </dl>
49   
50           <dl class="dropdown">
51             <dt id="three-ddheader" onmouseover="ddMenu('three',1)" onmouseout="ddMenu('three',-1)">inventory</dt>
52             <dd id="three-ddcontent" onmouseover="cancelHide('three')" onmouseout="ddMenu('three',-1)">
53               <ul>
54                 <li><a href="#" class="underline">check inventory</a></li>
55               </ul>
56             </dd>
57           </dl>
58           
59           <dl class="dropdown">
60             <dt id="four-ddheader" onmouseover="ddMenu('four',1)" onmouseout="ddMenu('four',-1)">returns/ex's</dt>
61             <dd id="four-ddcontent" onmouseover="cancelHide('four')" onmouseout="ddMenu('four',-1)">
62               <ul>
63                 <li><a href="#" class="underline">check inventory</a></li>
64               </ul>
65             </dd>
66           </dl>
67           
68           <dl class="dropdown">
69             <dt id="five-ddheader" onmouseover="ddMenu('five',1)" onmouseout="ddMenu('five',-1)">logout</dt>
70             <dd id="five-ddcontent" onmouseover="cancelHide('five')" onmouseout="ddMenu('five',-1)">
71               <ul>
72                 <li><a href="..login.aspx" class="underline">logout</a></li>
73               </ul>
74             </dd>
75           </dl>
76           <br /><br /><br />
77       <div id="container">
78           <asp:Panel ID="customer_header" runat="server" Visible="false" CssClass="box_header">
79               <h3>Customer Information</h3>
80           </asp:Panel>
81           <asp:Panel ID="customer_info" runat="server" Visible="false" CssClass="customer_info">
82               
83               <p>Company Name</p><asp:TextBox ID="co_name" runat="server"></asp:TextBox> <asp:ImageButton ID="co_name_srch_btn" runat="server" ImageUrl="~/POS/images/mag_glass.png" />
84               <p>Bill to address line 1</p><asp:TextBox ID="billto_address_line1" runat="server"></asp:TextBox>
85               <p>Bill to address line 2</p><asp:TextBox ID="billto_address_line2" runat="server"></asp:TextBox>
86               <p>Bill to address line 3</p><asp:TextBox ID="billto_address_line3" runat="server"></asp:TextBox>
87               <p>City (bill to)</p><asp:TextBox ID="billto_city" runat="server"></asp:TextBox>
88               <p>State</p><asp:DropDownList ID="billto_state" runat="server" 
89                   DataSourceID="SqlDataSource1" DataTextField="BILLTO_st_descrip" 
90                   DataValueField="BILLTO_st_descrip"></asp:DropDownList>
91               <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
92                   ConnectionString="<%$ MYCONNECTSTRING %>" 
93                   SelectCommand="SELECT [BILLTO_st_descrip] FROM [POS_BILLTO_state] ORDER BY [BILLTO_st_descrip]">
94               </asp:SqlDataSource>
95           </asp:Panel>
96           
97           <asp:Panel ID="cust_search_box" runat="server" Visible="false">
98               <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
99                   AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="co_id" 
100                  DataSourceID="SqlDataSource2" Width="400px" 
101                  EmptyDataText="No companies found.">
102                  <Columns>
103                      <asp:TemplateField>
104                          <ItemTemplate>
105                              <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="" Text=""></asp:HyperLink>
106                          </ItemTemplate>
107                      </asp:TemplateField>
108                      <asp:BoundField DataField="co_id" HeaderText="Co. ID" ReadOnly="True" 
109                          SortExpression="co_id" />
110                      <asp:BoundField DataField="co_name" HeaderText="Company Name" 
111                          SortExpression="co_name" />
112                      <asp:BoundField DataField="contact_person" HeaderText="Contact" 
113                          SortExpression="contact_person" />
114                  </Columns>
115              </asp:GridView>
116          </asp:Panel>
117     
118      </div>
119      <!-- sqldatasource 2 is for customer search box -->
120      <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
121          ConnectionString="<%$ MYCONNECTSTRING %>" 
122          SelectCommand="SELECT [co_id], [co_name], [contact_person] FROM [POS_cust_main] WHERE ([co_name] LIKE '%' + @co_name + '%')">
123          <SelectParameters>
124              <asp:ControlParameter ControlID="co_name" Name="co_name" PropertyName="Text" 
125                  Type="String" />
126          </SelectParameters>
127      </asp:SqlDataSource>
128      
129      <!-- sqldatasource3 is for binding information -->
130      <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
131                ConnectionString="<%$ MYCONNECTSTRING %>" 
132                OldValuesParameterFormatString="original_{0}" 
133                SelectCommand="SELECT [co_id], [co_name] FROM [POS_cust_main]">
134            </asp:SqlDataSource>
135      </form>
136  </body>
137  </html>
138  
  Thank you
0
mike6432
1/21/2009 8:30:01 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

0 Replies
1072 Views

Similar Articles

[PageSpeed] 31

Reply:

Similar Artilces:

Compiler Error Message: BC30311: Value of type 'System.Web.UI.Control' cannot be converted to 'IWizardStep'.
I am working with a Book ASPNET 2.0 Unleashed "by the way, great book". There code is witten with <script> tags and the vb is in the same page as the Html. So, as practice, I am simply trying to convert it to code behind... The page calls a class named "IWizardSetp" See both there code and my convered code below. I get the following error. What am I doing wrong? Details please if you can help... Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details a...

Having an error: BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Label'.
Error Message: Compiler Error Message: BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Label'. Line 13: myGetRandom.RetrieveDetails(lblQuestion.text, lblAnswers.text, lblViewCount.text, lblLastUpdated.text) Sub Page_Load Dim myGetRandom as new GetRandom myGetRandom.RetrieveDetails(lblQuestion.text, lblAnswers.text, lblViewCount.text, lblLastUpdated.text) End Sub Code behind Sub RetrieveDetails(lblQuestion as label, _ lblAnswers as label, _ lblViewCount as label, _ lblLastUpdated as...

Error: Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField'
Hello, I am getting the following error during compiliation. Any suggestions to fix it. Thanks. Cannot convert type 'System.Web.UI.Control' to 'System.Web.UI.WebControls.ButtonField' protected void gvEvents_RowCommand(Object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow selectedRow = gvEvents.Rows[index]; string sID; ButtonField btn; if (selectedRow.RowType == DataControlRowType.DataRow) { sID = ((ButtonField)selectedRow.FindControl("ID")).DataTextFi...

Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted to 'Date
I wrote a report in crystal reports, version 11 and wrote a .aspx page as a user interface for users to input data for their report selection. When I click on the link to take me to my .aspx page, I get the Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted to 'Date'. This report is currently working in our live version, but not test. The live version was written in VS2003, I am writing the modifications to the test version in VS2005.  I don't know if this may be part of the problem, the conversion between the two VS versions?  The repo...

Value of type 'System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap'.
 Hello,         I receive this error "System.Web.UI.Control' cannot be converted to 'System.Web.SiteMap" when I try to find the Sitemap control.  ...            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />            <asp:ListView ID="ListView1" runat="server">            <LayoutTemplate>    ...

Value of type 'Integer' cannot converted to 'System.Web.UI.WebControls.Unit'
I'd like to dynamically change the size of controls such as panel.In the code I putmainPage.Height = 500  'mainPage is a PanelHowever, it failed to compile with message;Value of type 'Integer' cannot converted to 'System.Web.UI.WebControls.Unit'How can I change the code so that it compiles? mainPage.Height = Unit.Pixel(500)  'mainPage is a PanelSonu Kapoor [MVP] Feel free to ask me any .NET question | Ajax Data Controls Forum It works very well. Thanks a lot....

Error Serializing Value 'System.Web.UI.WebCOntrols.TreeNode' of type 'System.Web.UI.WebCOntrols.TreeNode'
Hi, I am  getting the error stated in the subject when i am storing a TreeNode in a ViewState and then using it as follows if (ViewState["ProductCounty"]!=null) { TreeNode _productCountyNode = DataTree.FindNode(((TreeNode)ViewState["ProductCounty"]).ValuePath); _productCountyNode.Expand(); } what could be causing this error? Hi, I believe TreeNode isn't serializable in a way its required for objects which can be put to ViewState - as reference - (TreeNode implements IStateManager and is meant to work together with TreeView itself saving it...

BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.TextBox'.
 Hello everyone, I receive the error in the subject when viewing this page, I can get it to work fine without the master page and only the textboxes, but that causes an error with line 11, even when the page contents do process to the form. I don`t understand the error and I would appreciate any guidance on this. Thanks for reading.1 <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %> 2 3 <script runat="server"> 4 5 Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) 6 Dim D...

BC30311: Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Label'.
I have a pretty basic vb.net page that includes a listview.  (Note, this is my first time working with listview, so I may have some of the terminology wrong).  In my list view, I display all the important data for each record, and ask the user to provide a status for each record by including a radiobutton list with various responses.  At the bottom of the page is one submit button, and when the user clicks submit, I'm saving each records value based upon which response is selected in the radiobutton list. My saving of data is working,  but I'm ...

BC30311: Value of type 'System.Web.UI.WebControls.RadioButtonList' cannot be converted to 'String'.
I have a listview that I'm working with.  Each record returned by my sql query is displayed in my list view as text, with the exception of one field, which I need to display as a radiobutton list.  I tried to set the value of the radiobutton in my codebehind, but keep getting errors.  How do I tell this radiobutton list that the value that should be selected when the page loads is equal to the value returned from my sql query?    The line in bold throws the error... How am I supposed to indicate what value to have selected when the page loads? <asp:Radi...

BC30311: Value of type 'Control' cannot be converted to 'System.Web.UI.WebControls.CheckBox'
 Hi, can somebody help me on this problem. It works at first, but all of a sudden, it fails, and I can't find out why.    1 Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) 2 3 If Not CheckRequiredField() Then 4 MessageBox("Please complete the input data!") 5 Exit Sub 6 End If 7 8 Dim nRow As Integer 9 Dim Ctrl As Control 10 Dim chkDelete As Object 11 Dim LookupID, Name, Desc, Type As String 12 13 nRow = 0 14 1...

Compiler Error Message: CS0118: 'System.Web.Caching.Cache' is a 'type' but is used like a 'variable'
What am I missing??????????using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using com.amazon.webservices; using System.Web.Caching; /// <summary> /// Summary description for AmazonWS /// </summary> public class AmazonWS { public AmazonWS() { } public static DataSet AmazonToDataSet(string powersearchstring) { DataSet ds; //is it in the cache? if (Cache[powersearchstring] == null) { //create our query ItemSearchResponse response ...

Problem with AjaxControl kit error Compiler Error Message: CS0433: The type 'System.Web.UI.ScriptManager' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364
I'm trying to use the Tabs from the Ajaxcontrol kit.I have installed Ajax WebExtension 1.0 to the server i'm runnig the apps fromI'm sure the version of my Ajaxcontrol kit and the System.Web.Extensions i'm trying to use is 1.0.61025. But it seems the one on 3.5 is also there since the server has been updated to v3.5 .net framework I get this error below:  Compiler Error Message: CS0433: The type 'System.Web.UI.ScriptManager' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35\System.Web.Extensions.dll...

Dynamic read width from SQL, show error message: Cannot convert type 'string' to 'System.Web.UI.WebControls.Unit'
 I wrote new post, here is my code, just simple page show big image with dynamic width and height, but somehow the Width='<%# Eval("GalleryImageWidth")  %>' does not work. people in here give me some sugestion like : Width='<%# Eval("GalleryImageWidth")  + "px" %>' or  Width='<%# Convert.ToInt32("GalleryImageWidth") %>' or any body can tell what's wrong with my code?>>>>>>>>>>>>>>>>>>>>>>>>>>>>&...

Web resources about - Compiler Error Message: BC30311: Value of type 'System.Web.UI.DataSourceSelectArguments' cannot be converted to 'Integer'. - asp.net.getting-started

Resources last updated: 1/1/2016 2:40:27 PM