Connecting Tech Pros Worldwide Forums | Help | Site Map

gridview not waiting for user to hit go

Newbie
 
Join Date: Jun 2007
Posts: 3
#1: Jun 18 '07
I have three dropdowns, one is populated, the other two I'm just putting in values myself (facility, year, month). I have a gridview running a stored procedure that is waiting for values from the dropdowns so it can populate the grid.

I'd like to wait to populate the grid until the user selects values and hits go, but for some reason, it's just populating automatically. I tried putting in a "Please Select" in one of them, but then it complains that my input value is not right.

All three dropdowns are autopostback = false (advice from someone else).

Is there a property in the gridview I need to set?
here's the gridview code
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="gv_cust1" runat="server" AutoGenerateColumns="False" DataSourceID="udsp_SCCust1" CellPadding="4" ForeColor="#333333" GridLines="None">
  2.                         <Columns>
  3.                             <asp:BoundField DataField="Measure1" HeaderText="Measure1" ReadOnly="True" SortExpression="Measure1" />
  4.                             <asp:BoundField DataField="Measure2" HeaderText="Measure2" ReadOnly="True" SortExpression="Measure2" />
  5.                             <asp:BoundField DataField="Score" HeaderText="Score" ReadOnly="True" SortExpression="Score" />
  6.                         </Columns>
  7.                         <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  8.                         <RowStyle BackColor="#EFF3FB" />
  9.                         <EditRowStyle BackColor="#2461BF" />
  10.                         <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  11.                         <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  12.                         <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  13.                         <AlternatingRowStyle BackColor="White" />
  14.                     </asp:GridView>
  15.  
here's the sql that it runs
Expand|Select|Wrap|Line Numbers
  1. <asp:SqlDataSource ID="udsp_SCCust1" runat="server" ConnectionString="<%$ ConnectionStrings:Cypress_APPConnectionString %>"
  2.                         SelectCommand="udsp_ScorecardQuarterly" SelectCommandType="StoredProcedure">
  3.                         <SelectParameters>
  4.                             <asp:ControlParameter ControlID="ddlQuarter" Name="qtr" PropertyName="SelectedValue"
  5.                                 Type="Int32" />
  6.                             <asp:ControlParameter ControlID="ddlYear" Name="year" PropertyName="SelectedValue"
  7.                                 Type="Int32" />
  8.                             <asp:ControlParameter ControlID="ddlFacility" Name="entID" PropertyName="SelectedValue"
  9.                                 Type="Int32" />
  10.                         </SelectParameters>
  11.                     </asp:SqlDataSource>
  12.  
Any ideas?



nateraaaa's Avatar
Expert
 
Join Date: May 2007
Location: Illinois
Posts: 663
#2: Jun 18 '07

re: gridview not waiting for user to hit go


Quote:

Originally Posted by mattcushing

I have three dropdowns, one is populated, the other two I'm just putting in values myself (facility, year, month). I have a gridview running a stored procedure that is waiting for values from the dropdowns so it can populate the grid.

I'd like to wait to populate the grid until the user selects values and hits go, but for some reason, it's just populating automatically. I tried putting in a "Please Select" in one of them, but then it complains that my input value is not right.

All three dropdowns are autopostback = false (advice from someone else).

Is there a property in the gridview I need to set?
here's the gridview code

Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="gv_cust1" runat="server" AutoGenerateColumns="False" DataSourceID="udsp_SCCust1" CellPadding="4" ForeColor="#333333" GridLines="None">
  2.                         <Columns>
  3.                             <asp:BoundField DataField="Measure1" HeaderText="Measure1" ReadOnly="True" SortExpression="Measure1" />
  4.                             <asp:BoundField DataField="Measure2" HeaderText="Measure2" ReadOnly="True" SortExpression="Measure2" />
  5.                             <asp:BoundField DataField="Score" HeaderText="Score" ReadOnly="True" SortExpression="Score" />
  6.                         </Columns>
  7.                         <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  8.                         <RowStyle BackColor="#EFF3FB" />
  9.                         <EditRowStyle BackColor="#2461BF" />
  10.                         <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  11.                         <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  12.                         <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  13.                         <AlternatingRowStyle BackColor="White" />
  14.                     </asp:GridView>
  15.  
here's the sql that it runs
Expand|Select|Wrap|Line Numbers
  1. <asp:SqlDataSource ID="udsp_SCCust1" runat="server" ConnectionString="<%$ ConnectionStrings:Cypress_APPConnectionString %>"
  2.                         SelectCommand="udsp_ScorecardQuarterly" SelectCommandType="StoredProcedure">
  3.                         <SelectParameters>
  4.                             <asp:ControlParameter ControlID="ddlQuarter" Name="qtr" PropertyName="SelectedValue"
  5.                                 Type="Int32" />
  6.                             <asp:ControlParameter ControlID="ddlYear" Name="year" PropertyName="SelectedValue"
  7.                                 Type="Int32" />
  8.                             <asp:ControlParameter ControlID="ddlFacility" Name="entID" PropertyName="SelectedValue"
  9.                                 Type="Int32" />
  10.                         </SelectParameters>
  11.                     </asp:SqlDataSource>
  12.  
Any ideas?

Where is the datasource assigned for this gridview? If it is in the Page_Load event that may be the problem. If you want your grid to populate on a button click or postback from a drop down list you will need to assign you datasource and databind calls in those methods, NOT in the Page_Load. Let us know if this works.

Nathan
prabunewindia's Avatar
Familiar Sight
 
Join Date: Mar 2007
Location: Kerala, India
Posts: 199
#3: Jun 19 '07

re: gridview not waiting for user to hit go


hi friend,
make the populated dropdown list's autopostback as true
and code ur fill grid code in dropdown selected index changed event
Prabu

Quote:

Originally Posted by mattcushing

I have three dropdowns, one is populated, the other two I'm just putting in values myself (facility, year, month). I have a gridview running a stored procedure that is waiting for values from the dropdowns so it can populate the grid.

I'd like to wait to populate the grid until the user selects values and hits go, but for some reason, it's just populating automatically. I tried putting in a "Please Select" in one of them, but then it complains that my input value is not right.

All three dropdowns are autopostback = false (advice from someone else).

Is there a property in the gridview I need to set?
here's the gridview code

Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="gv_cust1" runat="server" AutoGenerateColumns="False" DataSourceID="udsp_SCCust1" CellPadding="4" ForeColor="#333333" GridLines="None">
  2.                         <Columns>
  3.                             <asp:BoundField DataField="Measure1" HeaderText="Measure1" ReadOnly="True" SortExpression="Measure1" />
  4.                             <asp:BoundField DataField="Measure2" HeaderText="Measure2" ReadOnly="True" SortExpression="Measure2" />
  5.                             <asp:BoundField DataField="Score" HeaderText="Score" ReadOnly="True" SortExpression="Score" />
  6.                         </Columns>
  7.                         <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  8.                         <RowStyle BackColor="#EFF3FB" />
  9.                         <EditRowStyle BackColor="#2461BF" />
  10.                         <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
  11.                         <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
  12.                         <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
  13.                         <AlternatingRowStyle BackColor="White" />
  14.                     </asp:GridView>
  15.  
here's the sql that it runs
Expand|Select|Wrap|Line Numbers
  1. <asp:SqlDataSource ID="udsp_SCCust1" runat="server" ConnectionString="<%$ ConnectionStrings:Cypress_APPConnectionString %>"
  2.                         SelectCommand="udsp_ScorecardQuarterly" SelectCommandType="StoredProcedure">
  3.                         <SelectParameters>
  4.                             <asp:ControlParameter ControlID="ddlQuarter" Name="qtr" PropertyName="SelectedValue"
  5.                                 Type="Int32" />
  6.                             <asp:ControlParameter ControlID="ddlYear" Name="year" PropertyName="SelectedValue"
  7.                                 Type="Int32" />
  8.                             <asp:ControlParameter ControlID="ddlFacility" Name="entID" PropertyName="SelectedValue"
  9.                                 Type="Int32" />
  10.                         </SelectParameters>
  11.                     </asp:SqlDataSource>
  12.  
Any ideas?

Reply