how to populate gridview asp.net 3.5 with objectdatasource

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • elka
    New Member
    • Feb 2010
    • 1

    how to populate gridview asp.net 3.5 with objectdatasource

    I 'm going to populate a gridview with data from stored procedure in SQL server.
    I wrote a method which returns a dataset. than I added an object datasource with all parameters.
    onbutton click I bind a gridview

    Code:
     protected void button1_Click(object sender, EventArgs e)
            {
            gvLookup.DataBind();
            }
    But nothing happened.

    would you able to tell me what Im doing wrong?
    Code:
    <asp:ObjectDataSource ID="AccessDatabase" runat="server" 
                SelectMethod="SearchCheck" TypeName="Cashiering.AccessDatabase">
                <SelectParameters>
                    <asp:ControlParameter ControlID="txtssn" Name="SSN" PropertyName="Text" 
                        Type="String" />
                    <asp:ControlParameter ControlID="txtAmount" Name="nAmount" PropertyName="Text" 
                        Type="String" />
                    <asp:ControlParameter ControlID="txtPlan" Name="sPlan" PropertyName="Text" 
                        Type="String" />
                    <asp:Parameter DefaultValue="0" Name="nMarket" Type="String" />
                    <asp:ControlParameter ControlID="txtParticipant" DefaultValue="" 
                        Name="sParticipant" PropertyName="Text" Type="String" />
                    <asp:ControlParameter ControlID="txtNumber" Name="cNumber" PropertyName="Text" 
                        Type="String" />
                    <asp:ControlParameter ControlID="txtSerNo" Name="sSerNo" PropertyName="Text" 
                        Type="String" />
                    <asp:Parameter DefaultValue="0" Name="dStart" Type="String" />
                    <asp:Parameter DefaultValue="0" Name="dEnd" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
    Last edited by tlhintoq; Feb 24 '10, 09:46 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Comment

    Working...