Avatar of 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" 
                    <RowStyle HorizontalAlign="Left" VerticalAlign="Top" />
                    <HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
                    <EditRowStyle HorizontalAlign="Left" VerticalAlign="Top" />
                <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" />
                <asp:ObjectDataSource ID="ObjectDataSource7" runat="server" 
                    SelectMethod="GetPorts" TypeName="PortsListService.PortsList">
                        <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" />
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.

Open in new window


Avatar of undefined
Last Comment

8/22/2022 - Mon