Avatar of mfwebteam
mfwebteam

asked on 

How do i count rows in a gridview which columns are bound to stored procedures in a webservice?

I need to check if the dataset returned by the webservice is empty. If it is wrtite out text to a label. I have 6 dropdown fields which are populated from webmethods via a webservice which is using stored procedures. (Data is collected from multiple tables) When all 6 dropdown is selected, a button click calls the webservice again and fills my gridview. The columns are bound to the webmethods. How can i check if my dataset contains zero result?
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                    AllowSorting="True" CaptionAlign="Left" Width="550px" 
                    DataSourceID="ObjectDataSource7"                 
                    AutoGenerateColumns="False"
                    >
                    <RowStyle HorizontalAlign="Left" VerticalAlign="Top" />
                    <HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
                    <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top" />
<Columns>
                <asp:BoundField DataField="prod" HeaderText="Product" SortExpression="Product" />
                <asp:BoundField DataField="ver" HeaderText="Version" SortExpression="Version" />
                <asp:BoundField DataField="OS" HeaderText="OS" SortExpression="OS" />
                <asp:BoundField DataField="OSVer" HeaderText="OSVer" SortExpression="OSVer" />
                <asp:BoundField DataField="CPU" HeaderText="CPU" SortExpression="CPU" />
                <asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
   
           </Columns>
                </asp:GridView>
                
 
                <asp:ObjectDataSource ID="ObjectDataSource7" runat="server" 
                    SelectMethod="GetPorts" TypeName="PortsListService.PortsList">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" Name="Prod" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList2" Name="Ver" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList3" Name="OS" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList4" Name="OSVer" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList5" Name="CPU" 
                            PropertyName="SelectedValue" Type="String" />
                        <asp:ControlParameter ControlID="DropDownList6" Name="Stat" 
                            PropertyName="SelectedValue" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
 
and i reference to the webservice in the code behind file:
PortsListService.PortsList myService = new PortsListService.PortsList();
            DataSet myDataSet = myService.GetPorts(Prod, Ver, OS, OSVer, CPU, Stat);
 
 
 
Prod, Ver, OS, OSVer, CPU, Stat  are parameters i pass from the dropdowns.
 
 
Any help is appriciated.
Thanks

Open in new window

ASP.NET

Avatar of undefined
Last Comment
mfwebteam

8/22/2022 - Mon