sql datagridview

Last post 03-19-2007 9:43 AM by textman. 23 replies.

Sort Posts:

  • Re: sql datagridview

    03-17-2007, 7:23 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    </

    script>

    <

    html xmlns="http://www.w3.org/1999/xhtml" >

    <

    head runat="server">

    <title>Untitled Page</title>

    </

    head>

    <

    body bgcolor=blue>

    <form id="form1" runat="server">

    <div>

    <asp:Button ID="Buttonsearchfred" runat="server" OnClick="GridView1_SelectedIndexChanged" Style="z-index: 100;

    left: 96px; position: absolute; top: 210px"

    Text="Button" Width="116px" />

    &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;

    &nbsp; &nbsp;

    <asp:Button ID="Button1" runat="server" PostBackUrl="~/placetestcrud.aspx" Style="z-index: 101;

    left: 103px; position: absolute; top: 693px"

    Text="jump to placetestcrud" Width="173px" />

    <asp:Button ID="Button2" runat="server" PostBackUrl="~/placeanorder.aspx" Style="z-index: 102;

    left: 379px; position: absolute; top: 695px"

    Text="jump to place order" Width="267px" />

    &nbsp;&nbsp;

    <asp:GridView ID="GridView1" runat="server" Height="248px" Style="z-index: 104; left: 339px;

    position: absolute; top: 126px"

    Width="754px" AllowPaging="True" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" PageSize="12" AutoGenerateColumns="False" OnSelectedIndexChanged="Button1_Click">

    <PagerSettings FirstPageText="first" LastPageText="last" Mode="NumericFirstLast" />

    <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />

    <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />

    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />

    <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />

    <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />

    </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Databasest1000ConnectionString1 %>"

    SelectCommand="usp_spcallB" SelectCommandType="StoredProcedure"></asp:SqlDataSource>

    &nbsp;&nbsp;

     

    </div>

    </form>

    </

    body>

    </

    html>
    rich
  • Re: sql datagridview

    03-17-2007, 7:40 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    naaaaaaaaaaaah!

    not going.........Databasest1000.SelectCommand = "sp_spcallA";

                         

    rich
  • Re: sql datagridview

    03-17-2007, 7:48 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256
    you get this going I send u $
    rich
  • Re: sql datagridview

    03-18-2007, 7:30 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    mat have found problem.

    Set break point in code......compiled ok.....but when click button

    break point dont appear?

    button being checked

    rich
  • Re: sql datagridview

    03-18-2007, 6:34 PM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    I have deleted page and started again...

    item gridview1

    item button...

    No source because Im calling the source myself.

    The stored procedure that executes in data base explorer are called.........usp_spcallA;

     

    <%

    @ Page Language="C#" %>

    <!

    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <

    script runat="server">

    protected void Button1_Click(object sender, EventArgs e)

    {

    //this is conecting to database

    SqlDataSource Databasest1000 = new SqlDataSource();

    Databasest1000.ConnectionString =

    ConfigurationManager.ConnectionStrings["Databasest1000ConnectionString1"].ToString();

    Databasest1000.SelectCommandType =

    SqlDataSourceCommandType.StoredProcedure;

    Databasest1000.SelectCommand =

    "usp_spcallA";

    GridView1.DataSource = Databasest1000;

    //GridView1.DataBind;

     

    }

    </

    script>

    <

    html xmlns="http://www.w3.org/1999/xhtml" >

    <

    head runat="server">

    <title>Untitled Page</title>

    </

    head>

    <

    body bgcolor=blue>

    <form id="form1" runat="server">

    <div>

    <asp:Button ID="Button1" runat="server" Style="z-index: 100; left: 43px; position: absolute;

    top: 219px"

    Text="press to load spA" Width="183px" OnClick="Button1_Click" />

    <asp:GridView ID="GridView1" runat="server" Height="307px" Style="z-index: 102; left: 475px;

    position: absolute; top: 130px"

    Width="582px" OnDataBinding="Button1_Click">

    </asp:GridView>

     

    </div>

    </form>

    </

    body>

    </

    html>

    This compiles but gridview is not visible during runtime and on button click....grid does not become visible

    The properties of the grid

    ........DataSourceID......clear

    ........DataBinding on clickevent property....button_clickevent

    selectedindexchanged....clear

    Connection string is fine so I think its just settings or binding?

    Currently Reading Wrox ASP.NET 2.0  with c# page 534

    any further suggestions for reading.......and dont say fishing books/

     

    rich
  • Re: sql datagridview

    03-19-2007, 6:10 AM
    • Participant
      960 point Participant
    • arshadras
    • Member since 07-08-2006, 8:05 AM
    • Karachi, Pakistan
    • Posts 165

    commet ur Button1_Click function and everything regarding databinding for GridView or simply create a new Test page and try this

       <asp:GridView ID="GridView2" runat="server"  AllowPaging="True"
                PageSize="12" DataSourceID="SqlDataSource2" >
                <PagerSettings FirstPageText="first" LastPageText="last" />
            </asp:GridView>

     <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Databasest1000ConnectionString1 %>"
                SelectCommand="usp_spcallB" >
            </asp:SqlDataSource>

    let me know if this doesn't work

    Arshad Rasheed - MCP
    Free ASP.Net & Ajax books
    Please mark the most helpful reply/replies as "Answer".
  • Re: sql datagridview

    03-19-2007, 9:01 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    compiled ok then on loading

    so close

    Server Error in '/st100016feb7' 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) +1242
       System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +128
       System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +102
       System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +52
       System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
       System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +125
       System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +56
       System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +138
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
       System.Web.UI.WebControls.GridView.DataBind() +4
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +41
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

    rich
  • Re: sql datagridview

    03-19-2007, 9:10 AM
    Answer
    • Participant
      960 point Participant
    • arshadras
    • Member since 07-08-2006, 8:05 AM
    • Karachi, Pakistan
    • Posts 165

    might be a ConnectionString problem .. set it manully using SqlDataSource property window

     

    Arshad Rasheed - MCP
    Free ASP.Net & Ajax books
    Please mark the most helpful reply/replies as "Answer".
  • Re: sql datagridview

    03-19-2007, 9:43 AM
    • Member
      171 point Member
    • textman
    • Member since 03-14-2007, 6:12 AM
    • uk
    • Posts 256

    yes ...yes ...yes ....

    Big Smile.......orsom well done arshad......

    Im so happy I could chuck

    I think it was a connection string problem in web config but some how its solve

    itself?.

    Can call both usp_spcallA    and     usp_spcallB........................sweet..

    Whaat can i say but thanks so much for helping a novice pull data from his new web dev.

    great Job 

    rich
Page 2 of 2 (24 items) < Previous 1 2