QueryStringParameter

L

Lammert

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>
 
C

Christopher Reed

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top