Solved

Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition.

Posted on 2013-05-21
3
766 Views
Last Modified: 2013-05-22
I created a gridview and I used the SqlDataSource wizard because I wanted to leverage all of the paging sorting editing etc, that it makes real easy. The problem is that once the initial data is displayed I need to be able to search.

So I create codebehind connection

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sql3 As String
        Dim strConn3 As String
        Dim ds3 As DataSet = New DataSet
        strConn3 = ConfigurationManager.ConnectionStrings("EMS_MainConnectionString").ConnectionString
        Dim Conn3 As New SqlConnection(strConn3)
        sql3 = "SELECT * FROM [tblAED_Address_Contact_Info] where organizationname like '%" & txtOrgName.Text & "%'"
        Dim cmd3 As New SqlDataAdapter(sql3, Conn3)
        cmd3.SelectCommand.CommandTimeout = 200
        cmd3.Fill(ds3)
        GridView1.DataSourceID = ""
        GridView1.DataSource = ds3
        GridView1.DataBind()
        Conn3.Close()

This works and avoids the "Both DataSource and DataSourceID are defined on 'GridView1'". error, but I lose all functionality gained by using the SqlDataSource in the first place. I am looking to have my cake and eat it too i guess.
0
Comment
Question by:bccops
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Jitendra Patil earned 500 total points
ID: 39186906
can you provide aspx code for your page?

suppose if you have used a sqldatasource  to bind your gridview you can always provide a sql select query from backend as

SqlDataSource1.SelectCommand = "SELECT * FROM [tblAED_Address_Contact_Info] where organizationname like '%" & txtOrgName.Text & "%'";

SqlDataSource1.Select(DataSourceSelectArguments.Empty);
SqlDataSource1.DataBind();
GridView1.DataBind();

the above code can be used in your button click event.

hope this helps.
0
 

Author Comment

by:bccops
ID: 39187738
Your code does work for me sort of.... it does in fact function, but the edit, delete etc buttons cause a refresh to all results as opposed to search results. Here is aspx code. I am told that the CRUD functions are usually done in a class, but I cannot find a good example of that either.  Thanks for the help!

<form id="form1" runat="server">
        <div>
            Search
            <asp:TextBox ID="txtOrgName" runat="server" Style="z-index: 100; left: 127px; position: absolute;
                top: 15px"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Style="z-index: 101; left: 296px; position: absolute;
                top: 15px" Text="Button" />

            <br />
            <br />
            <br />
            <br />

            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
                CellPadding="1" DataKeyNames="LocationID" DataSourceID="SqlDataSource1" ForeColor="Black"
                GridLines="Vertical" ShowFooter="True" CellSpacing="1" Font-Size="Smaller" AllowPaging="True" AllowSorting="True">
                <FooterStyle BackColor="#1C5E55" ForeColor="White" Font-Bold="True" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#E3EAEB" />
                <EditRowStyle BackColor="#7C6F57" />
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
                    <asp:TemplateField HeaderText="LocationID" InsertVisible="False" SortExpression="LocationID">
                        <EditItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("LocationID") %>'></asp:Label>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("LocationID") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:LinkButton ID="lb_insert" runat="server">Insert</asp:LinkButton>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="OrganizationName" InsertVisible="False" SortExpression="OrganizationName">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox2" runat="server" Text='<%# Bind("OrganizationName") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("OrganizationName") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_OrganizationName" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Address" InsertVisible="False" SortExpression="Address">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox3" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_Address" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="City" InsertVisible="False" SortExpression="City">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox4" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_City" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="State" InsertVisible="False" SortExpression="State">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox5" runat="server" Text='<%# Bind("State") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label6" runat="server" Text='<%# Bind("State") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_State" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="WorkPhone" InsertVisible="False" SortExpression="WorkPhone">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox6" runat="server" Text='<%# Bind("WorkPhone") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label7" runat="server" Text='<%# Bind("WorkPhone") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_WorkPhone" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="FaxNumber" InsertVisible="False" SortExpression="FaxNumber">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox7" runat="server" Text='<%# Bind("FaxNumber") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label8" runat="server" Text='<%# Bind("FaxNumber") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_FaxNumber" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Email" InsertVisible="False" SortExpression="Email">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox8" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label9" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_Email" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="DateJoined" InsertVisible="False" SortExpression="DateJoined">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox9" runat="server" Text='<%# Bind("DateJoined") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label10" runat="server" Text='<%# Bind("DateJoined") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_DateJoined" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="[ContactPerson]" InsertVisible="False" SortExpression="[ContactPerson]">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox10" runat="server" Text='<%# Bind("ContactPerson") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label11" runat="server" Text='<%# Bind("ContactPerson") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_ContactPerson" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Comment" InsertVisible="False" SortExpression="Comment">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox11" runat="server" Text='<%# Bind("Comment") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label12" runat="server" Text='<%# Bind("Comment") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_Comment" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="SiteActive" InsertVisible="False" SortExpression="SiteActive">
                        <EditItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("SiteActive") %>' />
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Bind("SiteActive") %>' />
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txt_SiteActive" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Zip" InsertVisible="False" SortExpression="Zip">
                        <EditItemTemplate>
                            <asp:TextBox ID="textbox12" runat="server" Text='<%# Bind("Zip") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label13" runat="server" Text='<%# Bind("Zip") %>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtzip" runat="server" Width="77px"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EMS_MainConnectionString %>"
                DeleteCommand="DELETE FROM [tblAED_Address_Contact_Info] WHERE [LocationID] = @LocationID"
                InsertCommand="INSERT INTO [tblAED_Address_Contact_Info] ([OrganizationName], [Address], [City], [State], [WorkPhone], [FaxNumber], [Email], [DateJoined], [ContactPerson], [Comment], [SiteActive], [Zip]) VALUES (@OrganizationName, @Address, @City, @State, @WorkPhone, @FaxNumber, @Email, @DateJoined, @Contact_Person, @Comment, @SiteActive, @Zip)"
                SelectCommand="SELECT * FROM [tblAED_Address_Contact_Info]"
                UpdateCommand="UPDATE tblAED_Address_Contact_Info SET OrganizationName = @OrganizationName, Address = @Address, City = @City, State = @State, WorkPhone = @WorkPhone, FaxNumber = @FaxNumber, Email = @Email, DateJoined = @DateJoined, ContactPerson = @Contact_Person, Comment = @Comment, SiteActive = @SiteActive, Zip = @Zip WHERE LocationID = @LocationID">
                <DeleteParameters>
                    <asp:Parameter Name="LocationID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="LocationID" Type="Int32" />
                    <asp:Parameter Name="OrganizationName" Type="String" />
                    <asp:Parameter Name="Address" Type="String" />
                    <asp:Parameter Name="City" Type="String" />
                    <asp:Parameter Name="State" Type="String" />
                    <asp:Parameter Name="WorkPhone" Type="String" />
                    <asp:Parameter Name="FaxNumber" Type="String" />
                    <asp:Parameter Name="Email" Type="String" />
                    <asp:Parameter Name="DateJoined" Type="DateTime" />
                    <asp:Parameter Name="Contact_Person" Type="String" />
                    <asp:Parameter Name="Comment" Type="String" />
                    <asp:Parameter Name="SiteActive" Type="Boolean" />
                    <asp:Parameter Name="Zip" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="LocationID" Type="Int32" />
                    <asp:Parameter Name="OrganizationName" Type="String" />
                    <asp:Parameter Name="Address" Type="String" />
                    <asp:Parameter Name="City" Type="String" />
                    <asp:Parameter Name="State" Type="String" />
                    <asp:Parameter Name="WorkPhone" Type="String" />
                    <asp:Parameter Name="FaxNumber" Type="String" />
                    <asp:Parameter Name="Email" Type="String" />
                    <asp:Parameter Name="DateJoined" Type="DateTime" />
                    <asp:Parameter Name="Contact_Person" Type="String" />
                    <asp:Parameter Name="Comment" Type="String" />
                    <asp:Parameter Name="SiteActive" Type="Boolean" />
                    <asp:Parameter Name="Zip" Type="String" />
                    <asp:Parameter Name="LocationID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            &nbsp;<br />
        </div>
        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="AEDunitID" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" AllowSorting="True" Font-Size="Smaller" ShowFooter="True">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:TemplateField HeaderText="AEDunitID" InsertVisible="False" SortExpression="AEDunitID">
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("AEDunitID") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("AEDunitID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="AEDunitBrand" SortExpression="AEDunitBrand">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("AEDunitBrand") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("AEDunitBrand") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="AEDunitModel" SortExpression="AEDunitModel">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("AEDunitModel") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("AEDunitModel") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="AEDunitSerialNum" SortExpression="AEDunitSerialNum">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("AEDunitSerialNum") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("AEDunitSerialNum") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Dateaquired" SortExpression="Dateaquired">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Dateaquired") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text='<%# Bind("Dateaquired") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Number of AEDs" SortExpression="Number of AEDs">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("[Number of AEDs]") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6" runat="server" Text='<%# Bind("[Number of AEDs]") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Location of AED" SortExpression="Location of AED">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("[Location of AED]") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7" runat="server" Text='<%# Bind("[Location of AED]") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Dispatch Instructions" SortExpression="Dispatch Instructions">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("[Dispatch Instructions]") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label8" runat="server" Text='<%# Bind("[Dispatch Instructions]") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Remote_Non-Remote" SortExpression="Remote_Non-Remote">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox8" runat="server" Text='<%# Bind("[Remote_Non-Remote]") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label9" runat="server" Text='<%# Bind("[Remote_Non-Remote]") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="LocationID" SortExpression="LocationID">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox9" runat="server" Text='<%# Bind("LocationID") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label10" runat="server" Text='<%# Bind("LocationID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Organization Name" SortExpression="Organization Name">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox10" runat="server" Text='<%# Bind("[Organization Name]") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label11" runat="server" Text='<%# Bind("[Organization Name]") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <EditRowStyle BackColor="#7C6F57" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:EMS_MainConnectionString %>" DeleteCommand="DELETE FROM [tblAEDunit_Location_Dispatch] WHERE [AEDunitID] = @AEDunitID" InsertCommand="INSERT INTO [tblAEDunit_Location_Dispatch] ([AEDunitBrand], [AEDunitModel], [AEDunitSerialNum], [Dateaquired], [Number of AEDs], [Location of AED], [Dispatch Instructions], [Remote_Non-Remote], [LocationID], [Organization Name]) VALUES (@AEDunitBrand, @AEDunitModel, @AEDunitSerialNum, @Dateaquired, @Number_of_AEDs, @Location_of_AED, @Dispatch_Instructions, @column1, @LocationID, @Organization_Name)" SelectCommand="SELECT * FROM [tblAEDunit_Location_Dispatch] WHERE ([LocationID] = @LocationID)" UpdateCommand="UPDATE [tblAEDunit_Location_Dispatch] SET [AEDunitBrand] = @AEDunitBrand, [AEDunitModel] = @AEDunitModel, [AEDunitSerialNum] = @AEDunitSerialNum, [Dateaquired] = @Dateaquired, [Number of AEDs] = @Number_of_AEDs, [Location of AED] = @Location_of_AED, [Dispatch Instructions] = @Dispatch_Instructions, [Remote_Non-Remote] = @column1, [LocationID] = @LocationID, [Organization Name] = @Organization_Name WHERE [AEDunitID] = @AEDunitID">
            <DeleteParameters>
                <asp:Parameter Name="AEDunitID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="AEDunitBrand" Type="String" />
                <asp:Parameter Name="AEDunitModel" Type="String" />
                <asp:Parameter Name="AEDunitSerialNum" Type="String" />
                <asp:Parameter Name="Dateaquired" Type="DateTime" />
                <asp:Parameter Name="Number_of_AEDs" Type="String" />
                <asp:Parameter Name="Location_of_AED" Type="String" />
                <asp:Parameter Name="Dispatch_Instructions" Type="String" />
                <asp:Parameter Name="column1" Type="String" />
                <asp:Parameter Name="LocationID" Type="Double" />
                <asp:Parameter Name="Organization_Name" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="LocationID" PropertyName="SelectedValue" Type="Double" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="AEDunitBrand" Type="String" />
                <asp:Parameter Name="AEDunitModel" Type="String" />
                <asp:Parameter Name="AEDunitSerialNum" Type="String" />
                <asp:Parameter Name="Dateaquired" Type="DateTime" />
                <asp:Parameter Name="Number_of_AEDs" Type="String" />
                <asp:Parameter Name="Location_of_AED" Type="String" />
                <asp:Parameter Name="Dispatch_Instructions" Type="String" />
                <asp:Parameter Name="column1" Type="String" />
                <asp:Parameter Name="LocationID" Type="Double" />
                <asp:Parameter Name="Organization_Name" Type="String" />
                <asp:Parameter Name="AEDunitID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </form>
0
 

Author Comment

by:bccops
ID: 39187860
Adding the following to codebehind gets me where i need to be actually. Unless you see something that will cause me other problems.

Imports System
Imports System.EventArgs
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.SqlClient
Partial Class aedapp
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            SqlDataSource1.SelectCommand = "SELECT * FROM [tblAED_Address_Contact_Info]"
        Else
            SqlDataSource1.SelectCommand = "SELECT * FROM [tblAED_Address_Contact_Info] where organizationname like '%" & txtOrgName.Text & "%'"

        End If


    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        SqlDataSource1.SelectCommand = "SELECT * FROM [tblAED_Address_Contact_Info] where organizationname like '%" & txtOrgName.Text & "%'"
        SqlDataSource1.Select(DataSourceSelectArguments.Empty)
        SqlDataSource1.DataBind()
        GridView1.DataBind()

    End Sub

End Class
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question