ASPX to SQL Server - page contents dependent on ?id= value
<%@ page title="" language="vb" masterpagefile="~/master1.master" autoeventwireup="false" codefile="details.aspx.vb" inherits="medical_details" %> <%-- add content controls here --%><asp:content id="content1" runat="server" contentplaceholderid="pagetext"> <div id="content"><h2>some title</h2><p>medical information for: {player name}</p> <p> <asp:detailsview id="detailsview1" runat="server" autogeneraterows="false" datakeynames="playerid" datasourceid="hgaadmin" height="50px"> <fields> <asp:boundfield datafield="playerid" headertext="player id" insertvisible="false" readonly="true" sortexpression="playerid" /> <asp:boundfield datafield="surname" headertext="surname" sortexpression="surname" /> <asp:boundfield datafield="firstnames" headertext="first name(s)" sortexpression="firstnames" /> <asp:boundfield datafield="address1" headertext="address 1" sortexpression="address1" /> <asp:boundfield datafield="address2" headertext="address 2" sortexpression="address2" /> <asp:boundfield datafield="address3" headertext="address 3" sortexpression="address3" /> <asp:boundfield datafield="postcode" headertext="post code" sortexpression="postcode" /> <asp:boundfield datafield="dob" headertext="dob" sortexpression="dob" /> <asp:boundfield datafield="emer1name" headertext="emergency contact 1 name" sortexpression="emer1name" /> <asp:boundfield datafield="emer1relation" headertext="emergency contact 1 relation" sortexpression="emer1relation" /> <asp:boundfield datafield="emer1address" headertext="emer1address" sortexpression="emer1address" /> <asp:boundfield datafield="emer1postcode" headertext="emer1postcode" sortexpression="emer1postcode" /> <asp:boundfield datafield="emer1daytime" headertext="emer1daytime" sortexpression="emer1daytime" /> <asp:boundfield datafield="emer1everning" headertext="emer1everning" sortexpression="emer1everning" /> <asp:boundfield datafield="emer1mobile" headertext="emer1mobile" sortexpression="emer1mobile" /> <asp:boundfield datafield="emer2name" headertext="emer2name" sortexpression="emer2name" /> <asp:boundfield datafield="emer2relation" headertext="emer2relation" sortexpression="emer2relation" /> <asp:boundfield datafield="emer2address1" headertext="emer2address1" sortexpression="emer2address1" /> <asp:boundfield datafield="emer2address2" headertext="emer2address2" sortexpression="emer2address2" /> <asp:boundfield datafield="emer2address3" headertext="emer2address3" sortexpression="emer2address3" /> <asp:boundfield datafield="emer2postcode" headertext="emer2postcode" sortexpression="emer2postcode" /> <asp:boundfield datafield="emer2daytime" headertext="emer2daytime" sortexpression="emer2daytime" /> <asp:boundfield datafield="emer2everning" headertext="emer2everning" sortexpression="emer2everning" /> <asp:boundfield datafield="emer2mobile" headertext="emer2mobile" sortexpression="emer2mobile" /> <asp:boundfield datafield="familydoc" headertext="familydoc" sortexpression="familydoc" /> <asp:boundfield datafield="familydocaddress" headertext="familydocaddress" sortexpression="familydocaddress" /> <asp:boundfield datafield="familydocpostcode" headertext="familydocpostcode" sortexpression="familydocpostcode" /> <asp:boundfield datafield="familydocdaytime" headertext="familydocdaytime" sortexpression="familydocdaytime" /> <asp:boundfield datafield="familydoceverning" headertext="familydoceverning" sortexpression="familydoceverning" /> <asp:boundfield datafield="dateantietanus" headertext="dateantietanus" sortexpression="dateantietanus" /> <asp:boundfield datafield="consultantname" headertext="consultantname" sortexpression="consultantname" /> <asp:boundfield datafield="consultanthospital" headertext="consultanthospital" sortexpression="consultanthospital" /> <asp:boundfield datafield="consultantregno" headertext="consultantregno" sortexpression="consultantregno" /> <asp:checkboxfield datafield="illnessdisability" headertext="illnessdisability" sortexpression="illnessdisability" /> <asp:boundfield datafield="illnessdetails" headertext="illnessdetails" sortexpression="illnessdetails" /> <asp:checkboxfield datafield="allergies" headertext="allergies" sortexpression="allergies" /> <asp:boundfield datafield="allergiesdetails" headertext="allergiesdetails" sortexpression="allergiesdetails" /> <asp:checkboxfield datafield="treatment" headertext="treatment" sortexpression="treatment" /> <asp:boundfield datafield="treatmentdetails" headertext="treatmentdetails" sortexpression="treatmentdetails" /> <asp:checkboxfield datafield="administerownmedication" headertext="administerownmedication" sortexpression="administerownmedication" /> <asp:checkboxfield datafield="culturalneeds" headertext="culturalneeds" sortexpression="culturalneeds" /> <asp:boundfield datafield="culturalneedsdetails" headertext="culturalneedsdetails" sortexpression="culturalneedsdetails" /> <asp:boundfield datafield="dateofsubmition" headertext="dateofsubmition" sortexpression="dateofsubmition" /> <asp:boundfield datafield="lastupdate" headertext="lastupdate" sortexpression="lastupdate" /> </fields> </asp:detailsview> </p> <p> <asp:sqldatasource id="hgaadmin" runat="server" connectionstring="<%$ connectionstrings:hgaadminconnectionstring %>" selectcommand="select * [medical]"></asp:sqldatasource> </p></div> </asp:content>
how make above page, relative variable set in url? for example if url was details.aspx?playerid=7 recored player id of 7 show in table
thanks joe
hi joe,
this forum sql server help. know you're using sqldatasource, doesn't make sql server question.
in future, you'll better off posting kind of inquiry on forums.asp.net - official microsoft asp.net forums.
that said, need do, believe, create asp:querystringparameter, , use querystringparameter in selectcommand. this:
does help?
aaron alton | thehobt.blogspot.com
this forum sql server help. know you're using sqldatasource, doesn't make sql server question.
in future, you'll better off posting kind of inquiry on forums.asp.net - official microsoft asp.net forums.
that said, need do, believe, create asp:querystringparameter, , use querystringparameter in selectcommand. this:
<asp:sqldatasource id="hgaadmin" runat="server" connectionstring="<%$ connectionstrings:hgaadminconnectionstring %>" selectcommand="select * [medical] playerid = @playerid"> <selectparameters> <asp:querystringparameter defaultvalue="0" name="playerid" querystringfield="playerid" /> </selectparameters> </asp:sqldatasource>
btw - if, when create sqldatasource, include parameters (as did), wizard walk through adding number of parameters.does help?
aaron alton | thehobt.blogspot.com
SQL Server > SQL Server Data Access
Comments
Post a Comment