session

E

Eugene Anthony

How do I use Session["videopath"] found in BlogListing.aspx.cs in

BlogListing.aspx. For example:

<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />

I want to replace qbert.flv with Session["videopath"]. The full coding
is as bellow.


BlogListing.aspx
----------------

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="BlogListing.aspx.cs" Inherits="_Default" %>

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

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>

<body>
<form id="form1" runat="server">
<table border="0" width="786" height="283">
<tr>
<td rowspan="9" height="277" style="text-align: center; width: 410px;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swfl
ash.cab#version=8,0,0,0" width="390" height="277" id="Untitled-1"
align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="Untitled-1.swf?thePath=qbert.flv" quality="high"
bgcolor="#ffffff" width="320" height="240" name="Untitled-1"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
<td width="360" bgcolor="#FFCC99">
<p align="center"><b>Personal Blogging</b></td>
</tr>
</table>
</form>
</body>
</html>



BlogListing.aspx.cs
-------------------

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
LoadData();
}

private void LoadData()
{
String videoID = Request.QueryString["VideoID"];

SqlConnection cnn = new
SqlConnection(ConfigurationManager.ConnectionStrings["myConnection"].Con
nectionString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = cnn;
myCommand.CommandText = "SELECT Video.VideoID, Video.RegistrationID,
Video.VideoPath, Category.Description FROM Video, Category WHERE
Video.VideoID=" + videoID + " AND Video.CategoryID =
Category.CategoryID";
myCommand.CommandType = CommandType.Text;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "Video");

Session["videopath"] =
ds.Tables[0].Rows[0].ItemArray.GetValue(3).ToString();

rptItems.DataSource = ds;
rptItems.DataBind();
}
protected void rptItems_ItemCommand(object source,
RepeaterCommandEventArgs e)
{
LoadData();
}
}


Eugene Anthony
 
G

Guest

Hello Eugene,

have you tryed this:
<param name="movie" value='<%= Session["videopath"].ToString() %>' />
I hope this should work.

Be careful this is simple example, it fail if session does not contain
videopath.

Regards,
Ladislav Mrnka

Eugene Anthony said:
How do I use Session["videopath"] found in BlogListing.aspx.cs in

BlogListing.aspx. For example:

<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />

I want to replace qbert.flv with Session["videopath"]. The full coding
is as bellow.


BlogListing.aspx
----------------

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="BlogListing.aspx.cs" Inherits="_Default" %>

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

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>

<body>
<form id="form1" runat="server">
<table border="0" width="786" height="283">
<tr>
<td rowspan="9" height="277" style="text-align: center; width: 410px;">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swfl
ash.cab#version=8,0,0,0" width="390" height="277" id="Untitled-1"
align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="Untitled-1.swf?thePath=qbert.flv" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="Untitled-1.swf?thePath=qbert.flv" quality="high"
bgcolor="#ffffff" width="320" height="240" name="Untitled-1"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</td>
<td width="360" bgcolor="#FFCC99">
<p align="center"><b>Personal Blogging</b></td>
</tr>
</table>
</form>
</body>
</html>



BlogListing.aspx.cs
-------------------

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Collections;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
LoadData();
}

private void LoadData()
{
String videoID = Request.QueryString["VideoID"];

SqlConnection cnn = new
SqlConnection(ConfigurationManager.ConnectionStrings["myConnection"].Con
nectionString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = cnn;
myCommand.CommandText = "SELECT Video.VideoID, Video.RegistrationID,
Video.VideoPath, Category.Description FROM Video, Category WHERE
Video.VideoID=" + videoID + " AND Video.CategoryID =
Category.CategoryID";
myCommand.CommandType = CommandType.Text;
SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds, "Video");

Session["videopath"] =
ds.Tables[0].Rows[0].ItemArray.GetValue(3).ToString();

rptItems.DataSource = ds;
rptItems.DataBind();
}
protected void rptItems_ItemCommand(object source,
RepeaterCommandEventArgs e)
{
LoadData();
}
}


Eugene Anthony
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top