asp.net - Gridview and passing SQL paramaters -


<%@ page title="" language="c#" masterpagefile="~/cp.master" autoeventwireup="true" codefile="cp_allquestions.aspx.cs" inherits="cp_allquestions" %>  <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="contentplaceholder1" runat="server">     <asp:gridview id="gridview1" runat="server" height="464px" width="932px"          autogeneratecolumns="false" datasourceid="answered">         <columns>             <asp:boundfield datafield="threadtitle" headertext="threadtitle"                  sortexpression="threadtitle" />         </columns> </asp:gridview>     <asp:sqldatasource id="answered" runat="server"          connectionstring="<%$ connectionstrings:cp_allquestionsanswered %>" selectcommand="select threadtitle threads t inner join users u on  t.usersid=u.usersid t.usersid=@userid">         <selectparameters>             <asp:parameter name="userid" />         </selectparameters>     </asp:sqldatasource> </asp:content> 

i want pass @userid @ page load event.

membershipuser currentuser = membership.getuser();   @userid = (guid)currentuser.provideruserkey; 

but how do it?

membershipuser currentuser = membership.getuser(); guid userid = (guid)currentuser.provideruserkey; answered.selectparameters.add("userid", userid.tostring().trim()); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -