List Info

Thread: gridview not showing any records




gridview not showing any records
country flaguser name
United States
2008-03-21 12:56:00
I know I'm forgetting something really simple stupid here.

Got a page with some txt boxes and drop downs, a gridview
and two
datasources. One of the datasources is used to populate a
drop down
and that works. The other datasource should be used to
populate the
gridview. The form fields are used as search parameters.
Leaving them
all blank should return all rows. I've set up a stored proc
for this,
and tested that in QA and it works.

When the page loads, the databinding and databound events
fire off - I
dont have any code in there other then a trace statement to
verify
it's running. And I have a trace statement to print out the
row count,
which is always coming back as 0. When i hit the submit
button,
neither of the databinding events fire off.

I'll paste the code from my aspx page dealing with the
gridview and
datasource. There's nothing to paste in the .cs page because
I dont
have any custom code in there. The only code I've put there
are just
the trace.write statements.

Thanks in advance for any help.

<asp:GridView ID="GridView1"
runat="server" AllowPaging="True"
                AllowSorting="True"
AutoGenerateColumns="False"
DataSourceID="sqldsMediaSearch"
               
EnableSortingAndPagingCallbacks="True"
HorizontalAlign="Center"
               
ondatabinding="GridView1_DataBinding"
ondatabound="GridView1_DataBound">
            <Columns>
                <asp:BoundField
DataField="FirstName"
HeaderText="FirstName"
                    SortExpression="FirstName"
/>
                <asp:BoundField
DataField="LastName"
HeaderText="LastName"
                    SortExpression="LastName"
/>
                <asp:BoundField
DataField="Address"
HeaderText="Address"
                    SortExpression="Address"
/>
                <asp:BoundField
DataField="City" HeaderText="City"
SortExpression="City" />
                <asp:BoundField
DataField="State" HeaderText="State"
SortExpression="State" />
                <asp:BoundField DataField="Zip"
HeaderText="Zip"
SortExpression="Zip" />
                <asp:BoundField
DataField="Country"
HeaderText="Country"
                    SortExpression="Country"
/>
                <asp:BoundField
DataField="Phone" HeaderText="Phone"
SortExpression="Phone" />
                <asp:BoundField
DataField="Email" HeaderText="Email"
SortExpression="Email" />
            </Columns>
            </asp:GridView>
            <asp:SqlDataSource ID="sqlds2"
runat="server"
                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
                SelectCommand="select * from
medialead"></asp:SqlDataSource>
            <asp:SqlDataSource
ID="sqldsMediaSearch" runat="server"
                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
                SelectCommand="spMediaLeadSearch"
SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter
ControlID="tbxFirstName"
Name="FirstN"
                        PropertyName="Text"
Type="String" />
                    <asp:ControlParameter
ControlID="tbxLastName"
Name="LastN" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter
ControlID="tbxAddress"
Name="Address" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter
ControlID="tbxCity"
Name="City" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter
ControlID="ddlState" Name="State"
                       
PropertyName="SelectedValue"
Type="String" />
                    <asp:ControlParameter
ControlID="tbxZip"
Name="Zip" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter
ControlID="ddlCountry" Name="Country"
                       
PropertyName="SelectedValue"
Type="String" />
                    <asp:ControlParameter
ControlID="tbxPhone"
Name="Phone" PropertyName="Text"
                        Type="String" />
                    <asp:ControlParameter
ControlID="tbxEmail"
Name="Email" PropertyName="Text"
                        Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: gridview not showing any records
country flaguser name
United States
2008-03-21 22:07:14
If the row count is coming back as zero then the gridview
won't render I
believe Ian ... haven't tested this but is your objective to
just return a
blank form and then to populate the database after the form
is filled out?

Ronda

On Fri, Mar 21, 2008 at 12:56 PM, Ian Lipsky
<aspadvice2imerk.net> wrote:

> I know I'm forgetting something really simple stupid
here.
>
> Got a page with some txt boxes and drop downs, a
gridview and two
> datasources. One of the datasources is used to populate
a drop down
> and that works. The other datasource should be used to
populate the
> gridview. The form fields are used as search
parameters. Leaving them
> all blank should return all rows. I've set up a stored
proc for this,
> and tested that in QA and it works.
>
> When the page loads, the databinding and databound
events fire off - I
> dont have any code in there other then a trace
statement to verify
> it's running. And I have a trace statement to print out
the row count,
> which is always coming back as 0. When i hit the submit
button,
> neither of the databinding events fire off.
>
> I'll paste the code from my aspx page dealing with the
gridview and
> datasource. There's nothing to paste in the .cs page
because I dont
> have any custom code in there. The only code I've put
there are just
> the trace.write statements.
>
> Thanks in advance for any help.
>
> <asp:GridView ID="GridView1"
runat="server" AllowPaging="True"
>                AllowSorting="True"
AutoGenerateColumns="False"
> DataSourceID="sqldsMediaSearch"
>               
EnableSortingAndPagingCallbacks="True"
> HorizontalAlign="Center"
>               
ondatabinding="GridView1_DataBinding"
> ondatabound="GridView1_DataBound">
>            <Columns>
>                <asp:BoundField
DataField="FirstName"
> HeaderText="FirstName"
>                    SortExpression="FirstName"
/>
>                <asp:BoundField
DataField="LastName"
HeaderText="LastName"
>                    SortExpression="LastName"
/>
>                <asp:BoundField
DataField="Address"
HeaderText="Address"
>                    SortExpression="Address"
/>
>                <asp:BoundField
DataField="City" HeaderText="City"
> SortExpression="City" />
>                <asp:BoundField
DataField="State" HeaderText="State"
> SortExpression="State" />
>                <asp:BoundField
DataField="Zip" HeaderText="Zip"
> SortExpression="Zip" />
>                <asp:BoundField
DataField="Country"
HeaderText="Country"
>                    SortExpression="Country"
/>
>                <asp:BoundField
DataField="Phone" HeaderText="Phone"
> SortExpression="Phone" />
>                <asp:BoundField
DataField="Email" HeaderText="Email"
> SortExpression="Email" />
>            </Columns>
>            </asp:GridView>
>            <asp:SqlDataSource ID="sqlds2"
runat="server"
>                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
>                SelectCommand="select * from
> medialead"></asp:SqlDataSource>
>            <asp:SqlDataSource
ID="sqldsMediaSearch" runat="server"
>                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
>               
SelectCommand="spMediaLeadSearch"
> SelectCommandType="StoredProcedure">
>                <SelectParameters>
>                    <asp:ControlParameter
ControlID="tbxFirstName"
> Name="FirstN"
>                        PropertyName="Text"
Type="String" />
>                    <asp:ControlParameter
ControlID="tbxLastName"
> Name="LastN" PropertyName="Text"
>                        Type="String" />
>                    <asp:ControlParameter
ControlID="tbxAddress"
> Name="Address" PropertyName="Text"
>                        Type="String" />
>                    <asp:ControlParameter
ControlID="tbxCity"
> Name="City" PropertyName="Text"
>                        Type="String" />
>                    <asp:ControlParameter
ControlID="ddlState" Name="State"
>                       
PropertyName="SelectedValue"
Type="String" />
>                    <asp:ControlParameter
ControlID="tbxZip"
> Name="Zip" PropertyName="Text"
>                        Type="String" />
>                    <asp:ControlParameter
ControlID="ddlCountry"
> Name="Country"
>                       
PropertyName="SelectedValue"
Type="String" />
>                    <asp:ControlParameter
ControlID="tbxPhone"
> Name="Phone" PropertyName="Text"
>                        Type="String" />
>                    <asp:ControlParameter
ControlID="tbxEmail"
> Name="Email" PropertyName="Text"
>                        Type="String" />
>                </SelectParameters>
>            </asp:SqlDataSource>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>



-- 
If you want to call me click here:
https://me.vonage.com/rka



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

Re: FW: gridview not showing any records
country flaguser name
United States
2008-03-21 18:44:52
Nope, but why would i need to? It actually turned out to be
a setting
with my data source:

CancelSelectOnNullParameter

That's set to true by default. So if any of my select
parameters were
blank, it didn't return anything. Changed it to true and its
working.

thanks

Ian

On Fri, Mar 21, 2008 at 2:49 PM, Raul Bastian
<raulbastianhotmail.com> wrote:
>
>
>
>
>  ________________________________
>  From: raulbastianhotmail.com
> To: aspnet-datadisplaycontrolsaspadvice.com
> Subject: RE: [aspnet-datadisplaycontrols] gridview not
showing any records
> Date: Fri, 21 Mar 2008 21:45:53 +0000
>
>
> Hi,
> I know this may sound stupid,
> But did you:
> GridView1.Databind()
> ??
>
> > Date: Fri, 21 Mar 2008 10:56:00 -0700
> > From: aspadvice2imerk.net
> > Subject: [aspnet-datadisplaycontrols] gridview not
showing any records
> > To: aspnet-datadisplaycontrolsaspadvice.com
>
>
> >
> > I know I'm forgetting something really simple
stupid here.
> >
> > Got a page with some txt boxes and drop downs, a
gridview and two
> > datasources. One of the datasources is used to
populate a drop down
> > and that works. The other datasource should be
used to populate the
> > gridview. The form fields are used as search
parameters. Leaving them
> > all blank should return all rows. I've set up a
stored proc for this,
> > and tested that in QA and it works.
> >
> > When the page loads, the databinding and databound
events fire off - I
> > dont have any code in there other then a trace
statement to verify
> > it's running. And I have a trace statement to
print out the row count,
> > which is always coming back as 0. When i hit the
submit button,
> > neither of the databinding events fire off.
> >
> > I'll paste the code from my aspx page dealing with
the gridview and
> > datasource. There's nothing to paste in the .cs
page because I dont
> > have any custom code in there. The only code I've
put there are just
> > the trace.write statements.
> >
> > Thanks in advance for any help.
> >
> > <asp:GridView ID="GridView1"
runat="server" AllowPaging="True"
> > AllowSorting="True"
AutoGenerateColumns="False"
> > DataSourceID="sqldsMediaSearch"
> > EnableSortingAndPagingCallbacks="True"
HorizontalAlign="Center"
> > ondatabinding="GridView1_DataBinding"
> > ondatabound="GridView1_DataBound">
> > <Columns>
> > <asp:BoundField DataField="FirstName"
HeaderText="FirstName"
> > SortExpression="FirstName" />
> > <asp:BoundField DataField="LastName"
HeaderText="LastName"
> > SortExpression="LastName" />
> > <asp:BoundField DataField="Address"
HeaderText="Address"
> > SortExpression="Address" />
> > <asp:BoundField DataField="City"
HeaderText="City"
> > SortExpression="City" />
> > <asp:BoundField DataField="State"
HeaderText="State"
> > SortExpression="State" />
> > <asp:BoundField DataField="Zip"
HeaderText="Zip"
> > SortExpression="Zip" />
> > <asp:BoundField DataField="Country"
HeaderText="Country"
> > SortExpression="Country" />
> > <asp:BoundField DataField="Phone"
HeaderText="Phone"
> > SortExpression="Phone" />
> > <asp:BoundField DataField="Email"
HeaderText="Email"
> > SortExpression="Email" />
> > </Columns>
> > </asp:GridView>
> > <asp:SqlDataSource ID="sqlds2"
runat="server"
> > ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
> > SelectCommand="select * from
medialead"></asp:SqlDataSource>
> > <asp:SqlDataSource
ID="sqldsMediaSearch" runat="server"
> > ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
> > SelectCommand="spMediaLeadSearch"
> > SelectCommandType="StoredProcedure">
> > <SelectParameters>
> > <asp:ControlParameter
ControlID="tbxFirstName"
> > Name="FirstN"
> > PropertyName="Text"
Type="String" />
> > <asp:ControlParameter
ControlID="tbxLastName"
> > Name="LastN"
PropertyName="Text"
> > Type="String" />
> > <asp:ControlParameter
ControlID="tbxAddress"
> > Name="Address"
PropertyName="Text"
> > Type="String" />
> > <asp:ControlParameter
ControlID="tbxCity"
> > Name="City"
PropertyName="Text"
> > Type="String" />
> > <asp:ControlParameter
ControlID="ddlState" Name="State"
> > PropertyName="SelectedValue"
Type="String" />
> > <asp:ControlParameter
ControlID="tbxZip"
> > Name="Zip"
PropertyName="Text"
> > Type="String" />
> > <asp:ControlParameter
ControlID="ddlCountry" Name="Country"
> > PropertyName="SelectedValue"
Type="String" />
> > <asp:ControlParameter
ControlID="tbxPhone"
> > Name="Phone"
PropertyName="Text"
> > Type="String" />
> > <asp:ControlParameter
ControlID="tbxEmail"
> > Name="Email"
PropertyName="Text"
> > Type="String" />
> > </SelectParameters>
> > </asp:SqlDataSource>
> >
> >
> > Need SQL Advice? http://sqladvice.com
> > Need RegEx Advice? http://regexadvice.com
> > Need XML Advice? http://xmladvice.com
>
>
>  ________________________________
>  Sigue los principales acontecimientos deportivos en
directo. MSN Motor
>
> ________________________________
> Todo ruedas: información práctica y todo el glamour del
mundo del motor. MSN
> Estilo y Tendencias


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: gridview not showing any records
user name
2008-03-21 16:45:53
Hi,
I know this may sound stupid,
But did you:
GridView1.Databind()
??
> Date: Fri, 21 Mar 2008 10:56:00 -0700> From:
aspadvice2imerk.net> Subject: [aspnet-datadisplaycontrols]
gridview not showing any records> To:
aspnet-datadisplaycontrolsaspadvice.com> > I
know I'm forgetting something really simple stupid here.>
> Got a page with some txt boxes and drop downs, a
gridview and two> datasources. One of the datasources is
used to populate a drop down> and that works. The other
datasource should be used to populate the> gridview. The
form fields are used as search parameters. Leaving them>
all blank should return all rows. I've set up a stored proc
for this,> and tested that in QA and it works.> >
When the page loads, the databinding and databound events
fire off - I> dont have any code in there other then a
trace statement to verify> it's running. And I have a
trace statement to print out the row count,> which is
always coming back as 0. When i hit the submit button,>
neither of the databinding events fire off.> > I'll
paste the code from my a
 spx page dealing with the gridview and> datasource.
There's nothing to paste in the .cs page because I dont>
have any custom code in there. The only code I've put there
are just> the trace.write statements.> > Thanks in
advance for any help.> > <asp:GridView
ID="GridView1" runat="server"
AllowPaging="True">
AllowSorting="True"
AutoGenerateColumns="False">
DataSourceID="sqldsMediaSearch">
EnableSortingAndPagingCallbacks="True"
HorizontalAlign="Center">
ondatabinding="GridView1_DataBinding">
ondatabound="GridView1_DataBound">>
<Columns>> <asp:BoundField
DataField="FirstName"
HeaderText="FirstName">
SortExpression="FirstName" />>
<asp:BoundField DataField="LastName"
HeaderText="LastName">
SortExpression="LastName" />>
<asp:BoundField DataField="Address"
HeaderText="Address">
SortExpression="Address" />>
<asp:BoundField DataField="City"
HeaderText="City">
SortExpression="City" />> <asp:BoundField
DataField="State" HeaderText="State">
SortExpression="State" />>
<asp:BoundField Da
 taField="Zip" HeaderText="Zip">
SortExpression="Zip" />> <asp:BoundField
DataField="Country"
HeaderText="Country">
SortExpression="Country" />>
<asp:BoundField DataField="Phone"
HeaderText="Phone">
SortExpression="Phone" />>
<asp:BoundField DataField="Email"
HeaderText="Email">
SortExpression="Email" />>
</Columns>> </asp:GridView>>
<asp:SqlDataSource ID="sqlds2"
runat="server"> ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"> SelectCommand="select * from
medialead"></asp:SqlDataSource>>
<asp:SqlDataSource ID="sqldsMediaSearch"
runat="server"> ConnectionString="<%$
ConnectionStringsefaultCo
nn %>">
SelectCommand="spMediaLeadSearch">
SelectCommandType="StoredProcedure">>
<SelectParameters>> <asp:ControlParameter
ControlID="tbxFirstName">
Name="FirstN"> PropertyName="Text"
Type="String" />> <asp:ControlParameter
ControlID="tbxLastName"> Name="LastN"
PropertyName="Text"> Type="String"
/>> <asp:ControlParameter
ControlID="tbxAddress">
Name="Address" PropertyName="Text">
  Type="String" />> <asp:ControlParameter
ControlID="tbxCity"> Name="City"
PropertyName="Text"> Type="String"
/>> <asp:ControlParameter
ControlID="ddlState" Name="State">
PropertyName="SelectedValue"
Type="String" />> <asp:ControlParameter
ControlID="tbxZip"> Name="Zip"
PropertyName="Text"> Type="String"
/>> <asp:ControlParameter
ControlID="ddlCountry"
Name="Country">
PropertyName="SelectedValue"
Type="String" />> <asp:ControlParameter
ControlID="tbxPhone"> Name="Phone"
PropertyName="Text"> Type="String"
/>> <asp:ControlParameter
ControlID="tbxEmail"> Name="Email"
PropertyName="Text"> Type="String"
/>> </SelectParameters>>
</asp:SqlDataSource>> > > Need SQL Advice? http://sqladvice.com>
Need RegEx Advice? http://regexadvice.com>
 Need XML Advice? http://xmladvice.com
____________________________________________________________
_____
La vida de los famosos al desnudo en MSN Entretenimiento
http://entretenimi
ento.es.msn.com/


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: gridview not showing any records
country flaguser name
United States
2008-03-22 22:20:31
actually, this was the problem:

CancelSelectOnNullParameter=true

set that to false and it worked.

Ian

On Fri, Mar 21, 2008 at 8:07 PM, Ronda K
<rondapedersongmail.com> wrote:
> If the row count is coming back as zero then the
gridview won't render I
>  believe Ian ... haven't tested this but is your
objective to just return a
>  blank form and then to populate the database after the
form is filled out?
>
>  Ronda
>
>
>
>  On Fri, Mar 21, 2008 at 12:56 PM, Ian Lipsky
<aspadvice2imerk.net> wrote:
>
>  > I know I'm forgetting something really simple
stupid here.
>  >
>  > Got a page with some txt boxes and drop downs, a
gridview and two
>  > datasources. One of the datasources is used to
populate a drop down
>  > and that works. The other datasource should be
used to populate the
>  > gridview. The form fields are used as search
parameters. Leaving them
>  > all blank should return all rows. I've set up a
stored proc for this,
>  > and tested that in QA and it works.
>  >
>  > When the page loads, the databinding and
databound events fire off - I
>  > dont have any code in there other then a trace
statement to verify
>  > it's running. And I have a trace statement to
print out the row count,
>  > which is always coming back as 0. When i hit the
submit button,
>  > neither of the databinding events fire off.
>  >
>  > I'll paste the code from my aspx page dealing
with the gridview and
>  > datasource. There's nothing to paste in the .cs
page because I dont
>  > have any custom code in there. The only code I've
put there are just
>  > the trace.write statements.
>  >
>  > Thanks in advance for any help.
>  >
>  > <asp:GridView ID="GridView1"
runat="server" AllowPaging="True"
>  >                AllowSorting="True"
AutoGenerateColumns="False"
>  > DataSourceID="sqldsMediaSearch"
>  >               
EnableSortingAndPagingCallbacks="True"
>  > HorizontalAlign="Center"
>  >               
ondatabinding="GridView1_DataBinding"
>  > ondatabound="GridView1_DataBound">
>  >            <Columns>
>  >                <asp:BoundField
DataField="FirstName"
>  > HeaderText="FirstName"
>  >                   
SortExpression="FirstName" />
>  >                <asp:BoundField
DataField="LastName"
HeaderText="LastName"
>  >                   
SortExpression="LastName" />
>  >                <asp:BoundField
DataField="Address"
HeaderText="Address"
>  >                   
SortExpression="Address" />
>  >                <asp:BoundField
DataField="City" HeaderText="City"
>  > SortExpression="City" />
>  >                <asp:BoundField
DataField="State" HeaderText="State"
>  > SortExpression="State" />
>  >                <asp:BoundField
DataField="Zip" HeaderText="Zip"
>  > SortExpression="Zip" />
>  >                <asp:BoundField
DataField="Country"
HeaderText="Country"
>  >                   
SortExpression="Country" />
>  >                <asp:BoundField
DataField="Phone" HeaderText="Phone"
>  > SortExpression="Phone" />
>  >                <asp:BoundField
DataField="Email" HeaderText="Email"
>  > SortExpression="Email" />
>  >            </Columns>
>  >            </asp:GridView>
>  >            <asp:SqlDataSource
ID="sqlds2" runat="server"
>  >                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
>  >                SelectCommand="select * from
>  > medialead"></asp:SqlDataSource>
>  >            <asp:SqlDataSource
ID="sqldsMediaSearch" runat="server"
>  >                ConnectionString="<%$
ConnectionStringsefaultCo
nn %>"
>  >               
SelectCommand="spMediaLeadSearch"
>  >
SelectCommandType="StoredProcedure">
>  >                <SelectParameters>
>  >                    <asp:ControlParameter
ControlID="tbxFirstName"
>  > Name="FirstN"
>  >                       
PropertyName="Text" Type="String" />
>  >                    <asp:ControlParameter
ControlID="tbxLastName"
>  > Name="LastN"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                    <asp:ControlParameter
ControlID="tbxAddress"
>  > Name="Address"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                    <asp:ControlParameter
ControlID="tbxCity"
>  > Name="City"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                    <asp:ControlParameter
ControlID="ddlState" Name="State"
>  >                       
PropertyName="SelectedValue"
Type="String" />
>  >                    <asp:ControlParameter
ControlID="tbxZip"
>  > Name="Zip"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                    <asp:ControlParameter
ControlID="ddlCountry"
>  > Name="Country"
>  >                       
PropertyName="SelectedValue"
Type="String" />
>  >                    <asp:ControlParameter
ControlID="tbxPhone"
>  > Name="Phone"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                    <asp:ControlParameter
ControlID="tbxEmail"
>  > Name="Email"
PropertyName="Text"
>  >                        Type="String"
/>
>  >                </SelectParameters>
>  >            </asp:SqlDataSource>
>  >
>  >
>  > Need SQL Advice? http://sqladvice.com
>  > Need RegEx Advice? http://regexadvice.com
>  > Need XML Advice? http://xmladvice.com
>  >
>
>
>
>  --
>  If you want to call me click here:
>  https://me.vonage.com/rka
>
>
>
>
>
>  Need SQL Advice? http://sqladvice.com
>  Need RegEx Advice? http://regexadvice.com
>  Need XML Advice? http://xmladvice.com
>
>


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )