none
Bogus DataSource, DataSourceID Error Message RRS feed

  • Question

  • I believe this may be a bug in the .NET runtime or perhaps in LINQ2SQL, but I am not sure where or how to report it? Can anyone help me?

    I have a simple C# web page that is using a gridview to display an email log. The grid is bound in the code behind to a LINQ2SQL query and there are no parameters set for the DataSource, or the DataSourceID in the gridview in the .aspx page. This page works fine in Visual Studio 2010. Compiles, runs with no errors or warnings. When we publish it to a server with IIS 6.0, it displays the following error:

    "Both DataSource and DataSourceID are defined on 'gridview1'.  Remove one definition" 

    The solution is to set  "grdVendorEmailLogs.DataSourceID = string.Empty;"  But why when there is no DataSourceID declared or set to begin with?

    Here is the gridview code:

     <asp:GridView ID="grdVendorEmailLogs" runat="server" AutoGenerateColumns="false"
                        Width="80%" CssClass="gvHeaderRow" Font-Names="Verdana" Font-Size="Small">
                        <Columns>
                            <asp:BoundField DataField="VendorEmail" HeaderText="Sent To" ReadOnly="True" SortExpression="VendorEmail" />
                            <asp:BoundField DataField="UserID" HeaderText="Sent By" ReadOnly="True" SortExpression="UserID" />
                            <asp:BoundField DataField="SentDateTime" DataFormatString="{0:d}" HeaderText="Date Sent" />
                        </Columns>
                        <SelectedRowStyle BackColor="#779977" ForeColor="White" />
                        <HeaderStyle BackColor="#6B696B" ForeColor="White" CssClass="gvHeaderRow" Wrap="false" />
                        <RowStyle BackColor="#F1E9DC" Font-Size="12px" HorizontalAlign="Center" />
                        <AlternatingRowStyle BackColor="White" Font-Size="12px" HorizontalAlign="Center" />
                    </asp:GridView>

    Here is the code behind for the binding:

    protected void PopulateVendorEmailGridView()
            {//Load the vendor enmail log for the CRQ id, use a try/catch to handle any errors
                try
                {
                    var query = pppCoreVendorEmailLogRepository.GetVendorEmailLogs(thisID);
                    grdVendorEmailLogs.DataSource = query;
                    grdVendorEmailLogs.DataBind();

                    if (grdVendorEmailLogs.Rows.Count == 0)
                    {
                        lblEmptyVendorEmailGridMessage.Text = "No e-mails have been sent to the vendor for this core return request.";
                    }
                    else
                    {
                        lblEmptyVendorEmailGridMessage.Text = "";
                    }
                }
                catch
                {
                    pnlVendorEmailLog.Visible = false;
                    pnlError.Visible = true;
                    lblFormErrors.Text = "Unable to Locate Vendor Email Log for ID = " + thisID.ToString();
                }
            }

    Here is the LINQ2SQL Repository Code:

     public static Object GetVendorEmailLogs(int crqID)
            {
                Mas500DataContext db = DbConnection.GetContext();
                var logs = from veml in db.pppCoreVendorEmailLogs
                               where veml.CRQRefID == crqID
                               select veml;
                return logs;
            }

     
    Any insight or help would be appreciated. If I have posted this to the wrong forum, please accept my humble apologies.

    np.

     

     

     

     

     

    • Moved by Bob Beauchemin Thursday, September 2, 2010 6:18 AM Moved to a more relevent forum (From:.NET Framework inside SQL Server)
    Wednesday, September 1, 2010 3:54 PM

Answers

  • This has been resolved. The issue was not a bug but caused by a script that misnamed a column in the database table. Sorry for the confusion.
    • Marked as answer by niko777 Thursday, September 2, 2010 9:42 PM
    Thursday, September 2, 2010 9:42 PM

All replies