473,802 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.s elect 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="s qlDSSearch"
AutoGenerateCol umns="true" AllowPaging="Tr ue" AllowSorting="T rue"
CellPadding="4" ForeColor="#333 333" GridLines="None ">

....some style stuff...

</asp:GridView>

<asp:SqlDataSou rce ID="sqlDSSearch " runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:csAutomatedB illing
%>"
SelectCommand=" PR_Search"
SelectCommandTy pe="StoredProce dure">
<SelectParamete rs>
<asp:FormParame ter FormField="txtA ccession"
Name="Accession " Type="String"
ConvertEmptyStr ingToNull="true " />
.....some more form parameters...
Type="String" ConvertEmptyStr ingToNull="true " />
<asp:FormParame ter FormField="ddlS tatus" Name="Status"
Type="String" ConvertEmptyStr ingToNull="true " />
</SelectParameter s>
</asp:SqlDataSour ce>
</form>

Nov 15 '06 #1
3 1474
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.s elect 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="s qlDSSearch"
AutoGenerateCol umns="true" AllowPaging="Tr ue" AllowSorting="T rue"
CellPadding="4" ForeColor="#333 333" GridLines="None ">

...some style stuff...

</asp:GridView>

<asp:SqlDataSou rce ID="sqlDSSearch " runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:csAutomatedB illing
%>"
SelectCommand=" PR_Search"
SelectCommandTy pe="StoredProce dure">
<SelectParamete rs>
<asp:FormParame ter FormField="txtA ccession"
Name="Accession " Type="String"
ConvertEmptyStr ingToNull="true " />
....some more form parameters...
Type="String" ConvertEmptyStr ingToNull="true " />
<asp:FormParame ter FormField="ddlS tatus" Name="Status"
Type="String" ConvertEmptyStr ingToNull="true " />
</SelectParameter s>
</asp:SqlDataSour ce>
</form>
Nov 15 '06 #2
Ok -- I got it to work, but only by putting
CancelSelectOnN ullParameter="f alse" 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.s elect 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="s qlDSSearch"
AutoGenerateCol umns="true" AllowPaging="Tr ue" AllowSorting="T rue"
CellPadding="4" ForeColor="#333 333" GridLines="None ">

...some style stuff...

</asp:GridView>

<asp:SqlDataSou rce ID="sqlDSSearch " runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:csAutomatedB illing
%>"
SelectCommand=" PR_Search"
SelectCommandTy pe="StoredProce dure">
<SelectParamete rs>
<asp:FormParame ter FormField="txtA ccession"
Name="Accession " Type="String"
ConvertEmptyStr ingToNull="true " />
....some more form parameters...
Type="String" ConvertEmptyStr ingToNull="true " />
<asp:FormParame ter FormField="ddlS tatus" Name="Status"
Type="String" ConvertEmptyStr ingToNull="true " />
</SelectParameter s>
</asp:SqlDataSour ce>
</form>
Nov 15 '06 #3
OK -- I got it to work, but I had to put
CancelSelectOnN ullParameter="f alse" parameter in my sqldatasource.
Problem is now the sqldatasource and gridview do their thing before the
form has been submitted.

I've set the CancelSelectOnN ullParameter="t rue" 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.s elect 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="s qlDSSearch"
AutoGenerateCol umns="true" AllowPaging="Tr ue" AllowSorting="T rue"
CellPadding="4" ForeColor="#333 333" GridLines="None ">

...some style stuff...

</asp:GridView>

<asp:SqlDataSou rce ID="sqlDSSearch " runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:csAutomatedB illing
%>"
SelectCommand=" PR_Search"
SelectCommandTy pe="StoredProce dure">
<SelectParamete rs>
<asp:FormParame ter FormField="txtA ccession"
Name="Accession " Type="String"
ConvertEmptyStr ingToNull="true " />
....some more form parameters...
Type="String" ConvertEmptyStr ingToNull="true " />
<asp:FormParame ter FormField="ddlS tatus" Name="Status"
Type="String" ConvertEmptyStr ingToNull="true " />
</SelectParameter s>
</asp:SqlDataSour ce>
</form>
Nov 15 '06 #4

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

Similar topics

3
5677
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 GridView to allow entry of quantity and Y/N switch for
6
3041
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 current_row_key of Grid1... to the objectDataSource2 parameter? (so that the second grid, gets only the information to do with current row of grid1)
4
2619
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 re-format the updated row fields. I have looked at gridView.rowUpdated method, but cannot figure out how....
7
14822
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 want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
1
3251
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 SQLDataSource. The GridView contains 3 columns: QuestionNumber, QuestionText, and a TemplateField. Each row in the GridView represents a question in a table (Ex.: "18. Satisfaction Level").
4
1816
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 the data on each click fetched from the server, or are they 'cached' on the client-side and so avoiding a lot of transferts between server and browser? If not 'cached', would it not bebetter to use the client callback
3
311
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 (regular gridview, no custom controls inside, bound to a list<custom object>) loose it's value after a postback. I know that the datasource is not saved in viewstate, but why are the rows getting cleared???? Thanks in advace Gonzalo, from...
1
8581
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 it doesn't seem to work at all. Below is my ASP.NET page, and further below, my VB.NET method that I am trying to call: <div id="admin-faq" class="page"> <h2>Site FAQs (Frequently Asked Questions)</h2>
4
11164
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 ReportTable As System.Data.DataTable = New System.Data.DataTable("SendTo") The ReportTable is populated row by row by data gotten back from the
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10536
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.