473,386 Members | 1,602 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,386 software developers and data experts.

QueryStringParameter

Hello,

I have a problem with the following code. When i add the
QueryStringParameter the page display nothing. The query is correct and
there is also a record with id=1. Who can help me?

Code:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="BeheerLeden.aspx.vb" Inherits="Secretaris_BeheerLeden" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnString %>"
ProviderName="<%$ ConnectionStrings:ConnString.ProviderName
%>"
SelectCommand="select id, voornaam, tussenvoegsels,
achternaam, geboortedatum from leden where id = @id"
DeleteCommand="DELETE from leden where id = @id" >
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Type="Int32"
Name="id" QueryStringField="id" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="voornaam"
HeaderText="voornaam" SortExpression="voornaam" />
<asp:BoundField DataField="tussenvoegsels"
HeaderText="tussenvoegsels" SortExpression="tussenvoegsels" />
<asp:BoundField DataField="achternaam"
HeaderText="achternaam" SortExpression="achternaam" />
<asp:BoundField DataField="geboortedatum"
HeaderText="geboortedatum" SortExpression="geboortedatum" />
<asp:CommandField ShowDeleteButton="true"
HeaderText="Verwijderen" DeleteText="Verwijder" />
<asp:HyperLinkField HeaderText="Bewerken" Text="Bewerk"
DataNavigateUrlFields="id"
DataNavigateUrlFormatString="EditLid.aspx?ID={0}"
/>
</Columns>
</asp:GridView>
&nbsp;</div>
</form>
</body>
</html>

Jan 23 '06 #1
1 1992
This doesn't work because it's looking for a querystring on the current
page, not the one you want to go. The QueryStringParameter should be used
in your EditLid.aspx page, not your GridView page.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Lammert" <lv****@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hello,

I have a problem with the following code. When i add the
QueryStringParameter the page display nothing. The query is correct and
there is also a record with id=1. Who can help me?

Code:
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="BeheerLeden.aspx.vb" Inherits="Secretaris_BeheerLeden" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnString %>"
ProviderName="<%$ ConnectionStrings:ConnString.ProviderName
%>"
SelectCommand="select id, voornaam, tussenvoegsels,
achternaam, geboortedatum from leden where id = @id"
DeleteCommand="DELETE from leden where id = @id" >
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<SelectParameters>
<asp:QueryStringParameter DefaultValue="1" Type="Int32"
Name="id" QueryStringField="id" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="voornaam"
HeaderText="voornaam" SortExpression="voornaam" />
<asp:BoundField DataField="tussenvoegsels"
HeaderText="tussenvoegsels" SortExpression="tussenvoegsels" />
<asp:BoundField DataField="achternaam"
HeaderText="achternaam" SortExpression="achternaam" />
<asp:BoundField DataField="geboortedatum"
HeaderText="geboortedatum" SortExpression="geboortedatum" />
<asp:CommandField ShowDeleteButton="true"
HeaderText="Verwijderen" DeleteText="Verwijder" />
<asp:HyperLinkField HeaderText="Bewerken" Text="Bewerk"
DataNavigateUrlFields="id"
DataNavigateUrlFormatString="EditLid.aspx?ID={0}"
/>
</Columns>
</asp:GridView>
&nbsp;</div>
</form>
</body>
</html>

Jan 25 '06 #2

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

Similar topics

2
by: Jim McGivney | last post by:
In ASP 2.0 I have an access database, with a table named comments whose primary key is an integer field named ID, and two string fields names Comment1 and Comment2. I am trying to use a...
7
by: staeri | last post by:
I want to insert values from the querystring but nothing happens with this code (the sp works great from the Query Analyzer): <form id="form1" runat="server"> <asp:SqlDataSource...
2
by: Phuff | last post by:
My Delete and select commands work like a charm, but Update won't work!! Can someone help?? <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"...
4
by: Mike | last post by:
I'm having trouble getting a gridview to bind. I probably missing something completely obvious and would appreciate any help on offer. I'm passing parameters via querystring, and have created a...
0
by: ~john | last post by:
I have an ObjectDataSource pointing at a class, which based on the SelectMethod and the parameter passed to it, returns an Object of my custom class. The SelectMethod is something like...
12
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that...
4
by: chris.c.woodward | last post by:
This event seems to be being raised twice in my codebehind. I have only one SelectMethod and do not have a SelectCountMethod. Its causing a problem because I'm dynamically loading a user control...
0
by: Sean | last post by:
I have a page that has a formview and two repeaters that use separate objectdatasources. Each objectdatasource returns records that contain a field named DateAndTime. The problem I'm having is...
11
BezerkRogue
by: BezerkRogue | last post by:
I have created a form using a datalist that is dynamically populated with report items based on search criteria. The form loads correctly but I can't seem to find a way to call the variables for the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...

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.