473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Dumb Gridview Question

OK I'm obviously fairly new to ASP.NET 2.0. I've used gridviews in the
past but only for pages with static queries that happen onload.

Now I have pretty simple scenario and I think I've followed all the
examples I've been able to find, but I still don't get the gridview to
render:

* I have a form with some textboxes and dropdownlist and a submit
button
* I have sqldatasource that uses form parameters to call a stored
procedure that does my query
* I have a gridview that is bound to the sqldatasource

At runtime, I fill in some know values and submit the form. The page
postsback and then I just see the form and the data entered -- the
gridview never appears.

I've tried adding an event handler for the button onclick that calls
the sqldatasource.select method. Same result.

I know there is something simple that I must be missing.

Any help from the world?

Jason

Here's some abrievated code:

<form id=...>
....some form elements...
....<asp:button...>

<asp:GridView ID="gvSearch" runat="server" DataSourceID="sqlDSSearch"
AutoGenerateColumns="true" AllowPaging="True" AllowSorting="True"
CellPadding="4" ForeColor="#333333" GridLines="None">

....some style stuff...

</asp:GridView>

<asp:SqlDataSource ID="sqlDSSearch" runat="server"
ConnectionString="<%$ ConnectionStrings:csAutomatedBilling
%>"
SelectCommand="PR_Search"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter FormField="txtAccession"
Name="Accession" Type="String"
ConvertEmptyStringToNull="true" />
.....some more form parameters...
Type="String" ConvertEmptyStringToNull="true" />
<asp:FormParameter FormField="ddlStatus" Name="Status"
Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
</form>

Nov 15 '06 #1
3 1454
I've also tried changing the form parameters to control parameters --
same result.
Jason Wilson wrote:
OK I'm obviously fairly new to ASP.NET 2.0. I've used gridviews in the
past but only for pages with static queries that happen onload.

Now I have pretty simple scenario and I think I've followed all the
examples I've been able to find, but I still don't get the gridview to
render:

* I have a form with some textboxes and dropdownlist and a submit
button
* I have sqldatasource that uses form parameters to call a stored
procedure that does my query
* I have a gridview that is bound to the sqldatasource

At runtime, I fill in some know values and submit the form. The page
postsback and then I just see the form and the data entered -- the
gridview never appears.

I've tried adding an event handler for the button onclick that calls
the sqldatasource.select method. Same result.

I know there is something simple that I must be missing.

Any help from the world?

Jason

Here's some abrievated code:

<form id=...>
...some form elements...
...<asp:button...>

<asp:GridView ID="gvSearch" runat="server" DataSourceID="sqlDSSearch"
AutoGenerateColumns="true" AllowPaging="True" AllowSorting="True"
CellPadding="4" ForeColor="#333333" GridLines="None">

...some style stuff...

</asp:GridView>

<asp:SqlDataSource ID="sqlDSSearch" runat="server"
ConnectionString="<%$ ConnectionStrings:csAutomatedBilling
%>"
SelectCommand="PR_Search"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter FormField="txtAccession"
Name="Accession" Type="String"
ConvertEmptyStringToNull="true" />
....some more form parameters...
Type="String" ConvertEmptyStringToNull="true" />
<asp:FormParameter FormField="ddlStatus" Name="Status"
Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
</form>
Nov 15 '06 #2
Ok -- I got it to work, but only by putting
CancelSelectOnNullParameter="false" in sqldatasource. Problem is now
that it renderes of page load before the form has been submitted. Any
ideas on how to make it only render on postback?

Jason Wilson wrote:
OK I'm obviously fairly new to ASP.NET 2.0. I've used gridviews in the
past but only for pages with static queries that happen onload.

Now I have pretty simple scenario and I think I've followed all the
examples I've been able to find, but I still don't get the gridview to
render:

* I have a form with some textboxes and dropdownlist and a submit
button
* I have sqldatasource that uses form parameters to call a stored
procedure that does my query
* I have a gridview that is bound to the sqldatasource

At runtime, I fill in some know values and submit the form. The page
postsback and then I just see the form and the data entered -- the
gridview never appears.

I've tried adding an event handler for the button onclick that calls
the sqldatasource.select method. Same result.

I know there is something simple that I must be missing.

Any help from the world?

Jason

Here's some abrievated code:

<form id=...>
...some form elements...
...<asp:button...>

<asp:GridView ID="gvSearch" runat="server" DataSourceID="sqlDSSearch"
AutoGenerateColumns="true" AllowPaging="True" AllowSorting="True"
CellPadding="4" ForeColor="#333333" GridLines="None">

...some style stuff...

</asp:GridView>

<asp:SqlDataSource ID="sqlDSSearch" runat="server"
ConnectionString="<%$ ConnectionStrings:csAutomatedBilling
%>"
SelectCommand="PR_Search"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter FormField="txtAccession"
Name="Accession" Type="String"
ConvertEmptyStringToNull="true" />
....some more form parameters...
Type="String" ConvertEmptyStringToNull="true" />
<asp:FormParameter FormField="ddlStatus" Name="Status"
Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
</form>
Nov 15 '06 #3
OK -- I got it to work, but I had to put
CancelSelectOnNullParameter="false" parameter in my sqldatasource.
Problem is now the sqldatasource and gridview do their thing before the
form has been submitted.

I've set the CancelSelectOnNullParameter="true" in the datasource and
then changed in back in the onload event handler if the page.IsPostBack
= "true" but this seems a little clunky -- is this what everyone else
is doing?

How come none of the examples I've seen seem to be doing this. I guess
it's because all the examples either have all of the controls empty or
none of them.

Jason

Jason Wilson wrote:
OK I'm obviously fairly new to ASP.NET 2.0. I've used gridviews in the
past but only for pages with static queries that happen onload.

Now I have pretty simple scenario and I think I've followed all the
examples I've been able to find, but I still don't get the gridview to
render:

* I have a form with some textboxes and dropdownlist and a submit
button
* I have sqldatasource that uses form parameters to call a stored
procedure that does my query
* I have a gridview that is bound to the sqldatasource

At runtime, I fill in some know values and submit the form. The page
postsback and then I just see the form and the data entered -- the
gridview never appears.

I've tried adding an event handler for the button onclick that calls
the sqldatasource.select method. Same result.

I know there is something simple that I must be missing.

Any help from the world?

Jason

Here's some abrievated code:

<form id=...>
...some form elements...
...<asp:button...>

<asp:GridView ID="gvSearch" runat="server" DataSourceID="sqlDSSearch"
AutoGenerateColumns="true" AllowPaging="True" AllowSorting="True"
CellPadding="4" ForeColor="#333333" GridLines="None">

...some style stuff...

</asp:GridView>

<asp:SqlDataSource ID="sqlDSSearch" runat="server"
ConnectionString="<%$ ConnectionStrings:csAutomatedBilling
%>"
SelectCommand="PR_Search"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter FormField="txtAccession"
Name="Accession" Type="String"
ConvertEmptyStringToNull="true" />
....some more form parameters...
Type="String" ConvertEmptyStringToNull="true" />
<asp:FormParameter FormField="ddlStatus" Name="Status"
Type="String" ConvertEmptyStringToNull="true" />
</SelectParameters>
</asp:SqlDataSource>
</form>
Nov 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
4
by: Nalaka | last post by:
Hi, I have two questions about gridViews. 1. How can I intercept the row/column values at loading to change values? 2. After I update a row (using default update functionality), how can I...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
4
by: Chris | last post by:
Hi, I read about client callback and i have a question. Assume the option "sorting" is set in a gridview. Each time the user clicks on a fieldname, the data are sorted. My question is: are...
3
by: Gonza | last post by:
Hi group, i have a question relatred to gridview and postback (i should probably know this by now, considering i've been working with .net for a few years now, but baahh). Why could a gridview...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
4
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have a vb.net 2.0 app that is loading a GridView with a DataSource that is returned from a function. The definitions in the function are: Dim ReportDS As DataSet = New DataSet Dim...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.