I have really weird situation. I've created new aspx page, and without using ANY custom logic objects (everything created with visual studios wizards) tried to create grid view from sqldatasource.
The data comes from stored procedure, with single parameter which has default value. when I refresh the schema or click "test query", I see result rows and GridViews fields are corectly created. But when I run the page there is no grid view (it's simply empty - when I add EmptyDataTemplate it is shown) . I've added custom (empty) function and DataBind, DataBinded and RowCreted event, and only databind and datavound events are fired (although, as I wrote - the stored procedure with its default parameter return rows and .net can read them in design mode)
There isn't anything "fancy" in the procedure, I've done this more than once with no problem. I've tried another stored procedure wich works in our production env and still got the same emty gridview
here is the code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TEST.aspx.cs" Inherits="site.TEST" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
AllowSorting="True" OnDataBinding="GridView1_DataBinding" OnDataBound="GridView1_DataBound"
OnRowCreated="GridView1_RowCreated">
<EmptyDataTemplate>
No Data Available
</EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
SelectCommand="myStoredProcedure" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter DefaultValue="val1" Name="par1" Type="String" />
<asp:Parameter Name="val2" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
and the codebehind
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace site
{
public partial class TEST : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{//brake here
}
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{//brake here
}
protected void GridView1_DataBinding(object sender, EventArgs e)
{//brake here
}
protected void GridView1_DataBound(object sender, EventArgs e)
{//brake here
}
}
}