hi
I use gridview in page that I want bind it from 2 table below is gridview:
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false" Width="500px">
<Columns>
<asp:TemplateField ItemStyle-Width="24px" ItemStyle-VerticalAlign="Middle" ItemStyle-ForeColor="Red">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#Eval("Pcode")%>'></asp:Label>
<asp:HyperLink ID="HPtemporary" runat="server" CssClass="hpemail" NavigateUrl='<%#Eval("DownLoadToken","http://digimaster.ir/downloads/{0}")%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
and store procedure:
ALTER procedure [dbo].[DownloadurlToken]
@Authority NVARCHAR(50)
as
begin
select
(select Download.id from Download where Download.Authority=@Authority) id,
(select Download.url from Download where Download.Authority=@Authority) url,
(select Download.DownLoadToken from Download where Download.Authority=@Authority) DownLoadToken,
(select Temp_Users.pcode from Temp_Users where Temp_Users.Authority=@Authority) pcode
end
and behind code:
private void ShowTemporaryLink()
{
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand _cmd = General.GetCommand("DownloadurlToken", conn))
{
string ipAddress;
ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipAddress == "" || ipAddress == null)
ipAddress = Request.ServerVariables["REMOTE_ADDR"];
_cmd.Parameters.AddWithValue("@Authority", Request.QueryString["Authority"].ToString());
conn.Open();
SqlDataReader _drA = _cmd.ExecuteReader();
if (_drA.HasRows)
{
DataTable dt = new DataTable();
dt.Columns.Add("UrlId");
dt.Columns.Add("Url");
dt.Columns.Add("DownLoadToken");
if (_drA.HasRows)
{
while (_drA.Read())
{
dt.Rows.Add(_drA["Id"].ToString(), _drA["Url"].ToString(), _drA["DownLoadToken"].ToString());
}
}
GridView2.DataSource = dt;
GridView2.DataBind();
}
}
}
}
but it doesn't bind gridview...
is SP currect?
Best regards
neda