Just Add
GridView1.DataSourceID =Nothing
Before
GridView1.DataSource = ds
Main Topics
Browse All TopicsHi;
I am trying to bind a gridview to a web method like so :
see code part 1:
and I get this error :
Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition. 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.InvalidOperationExc
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:
[InvalidOperationException
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Control.Load
System.Web.UI.Control.Load
System.Web.UI.Control.Load
System.Web.UI.Page.Process
I am binding to the gridview at run time through a web service proxy ?
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi;
Thanks for your suggestions !
I am binding to the datasource at run time not at design time.
So both properties on the gridview design, datasource and datasourceID, are blank.
I tried setting the datasourceID to blank in my code behind and that didn't work.
Should I try to look at the microsoft source code for the web page ?
The problem might be buried in the 10K plus lines of code.
Man, this is a tuff nut to crack !
Hi;
Here is the web page source as per your request.
Also I have attached the error message as it occured when I hit the gridview1.databind line.
Thanks
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
Hi;
Another clue ?
A coworker suggested that I quote the parameters that I am passing to my web method.
When I did this on an app which is located in the web services directory it returned the dataset no problems.
But when I tried calling the web method from an extermal app using the quoted parameters I still got the same error about choosing the datasource or datasourceID error.
Why did it work locally ?
Thanks
Hi;
I am still trying to get a handle on my problem.
I tried running the web service on it's server from IE.
We are using IE 6.0.
When I invoke the web method a dataset is not returned.
I am able to get one returned from the local web server.
Is there a setting in IIS that could be preventing this ?
Thanks
Business Accounts
Answer for Membership
by: DaTribePosted on 2009-11-03 at 23:33:09ID: 25737158
From the design view check the GridView Properties and remove the value in The DataSourceID