Thanks. I've removed that "No record" message inside EmptyDataTemplate. Please note that there is a Formview within that. But why do I get this?
Server Error in '/app2' Application.
--------------------------------------------------------------------------------
Format of the initialization string does not conform to specification starting at index 0.
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.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
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:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +6713793
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +253
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +134
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +103
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +35
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +294
System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +60
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +89
System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +49
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +209
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +28
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
app2._Default.BindGridView() in C:\app2\Default.aspx.cs:35
app2._Default.Page_Load(Object sender, EventArgs e) in C:\app2\Default.aspx.cs:22
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 01:33 AM|LINK
Hi,
I cannot open your image with my browser at home.
Then do you wanna do CURD (Create/Update/Delete) in GridView?
Your thoughts make me feel puzzled, too.
I don't know what you really want to do——sometimes GridView.DataSource, then SqlDataSource……
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 01:39 AM|LINK
Have you got QQ or MSN?
Maybe you can add this and we can chat directly.
wmec
Contributor
6224 Points
3221 Posts
Re: No prompt for data input
Feb 03, 2013 01:40 AM|LINK
I've just sent the screenshot to your Email (in Microsoft).
I want to be able to input data to the Gridview when it is displayed there. But I now only see the message in the screenshot.
Could you please take your time to show what I should adjust my codes to allow this?
HuaMin Chen
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 02:05 AM|LINK
OK, but I'll see when I'm free;)
And it would be possible if you can paste all of your current codes (aspx and cs)
And tell us what actually happens and what's your expected thing?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 04:22 AM|LINK
Hi,
From your image I see that No Data is available.
Please make sure that you've bind to the GridView with correct DataSource.
wmec
Contributor
6224 Points
3221 Posts
Re: No prompt for data input
Feb 03, 2013 07:53 AM|LINK
Thanks. How to ensure this and do the adjustments to my codes above?
HuaMin Chen
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 07:58 AM|LINK
Either use SqlDataSource or manually data-binding.
But you must make sure that your Source has values.
wmec
Contributor
6224 Points
3221 Posts
Re: No prompt for data input
Feb 03, 2013 08:04 AM|LINK
Hi,
Does "having values in the source" mean there is records in the table?
For my current case, as there is no records in the table, how can I enable insert/data input there?
HuaMin Chen
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: No prompt for data input
Feb 03, 2013 10:31 AM|LINK
Yes.
Without data contents you can never see the GridView shown.
You have to enable teh EmptyDataTemplate, where put some TextBoxes and do inserting:
http://www.dotnetfunda.com/articles/article180.aspx
wmec
Contributor
6224 Points
3221 Posts
Re: No prompt for data input
Feb 04, 2013 01:26 AM|LINK
Thanks. I've removed that "No record" message inside EmptyDataTemplate. Please note that there is a Formview within that. But why do I get this?
Server Error in '/app2' Application.
--------------------------------------------------------------------------------
Format of the initialization string does not conform to specification starting at index 0.
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.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
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:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +6713793
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +253
System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +134
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +103
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +35
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +294
System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +60
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +89
System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +49
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +209
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +28
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
app2._Default.BindGridView() in C:\app2\Default.aspx.cs:35
app2._Default.Page_Load(Object sender, EventArgs e) in C:\app2\Default.aspx.cs:22
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
while here are 2 events
protected void Page_Load(object sender, EventArgs e)
{
20 if (!IsPostBack)
21 {
22 BindGridView();
23 }
tb_join_dt.Text = DateTime.Now.GetDateTimeFormats('d')[0];
/*if (FormView1.DataItemCount == 0)
{
FormView1.DefaultMode = System.Web.UI.WebControls.FormViewMode.Insert;
}*/
}
private void BindGridView()
{
//DataTable dt = new DataTable();
//dt = (DataTable)Session["SqlDataSource2"];
//gv2.DataSource = GetDataSource();
35 gv2.DataBind();
}
....
HuaMin Chen