C#Novice 0 Newbie Poster

I have an application where i need to show 2 frames. the top frame shows 2 windows media players, one that shows the video of a lecture and the other shows the video of images for the same lecture. In the lower frame i want to show all the imagesassociated with the lecture, so that when the user clicks on one image the video chunk associated with that image is shown in the upper frame.
The video main file (that houses the 2 frames is as follows)

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
string flcode = Request.QueryString["f"].ToString().Trim();
string cpcode = Request.QueryString["c"].ToString().Trim();//image code
string cpPath = Request.QueryString["p"].ToString().Trim();//image path
lblflcode.Text = flcode;
lblcpcode.Text = cpcode;
lblcpPath.Text = cpPath;
if (cpcode == "" || cpcode==string.Empty || cpcode==null && cpPath=="" || cpPath==string.Empty || cpPath== null)
{					
GetTopFrame();
GetBottomFrame();
}
}
}
public string GetTopFrame()
{
string flcode = lblflcode.Text.ToString().Trim();
string cpcode="";
string cppath ="";
return "<frame name=\"top\" src=\"TopVideoMain.aspx?f="+flcode+"&c="+cpcode+"&p="+cppath+"\">";		
}

public string GetBottomFrame()
{
string flcode = lblflcode.Text.ToString().Trim();
return "<frame name=\"top\"	src=\"BottomVideoMain.aspx?f="+flcode+"\" >";
}

TopVideoMain.aspx
public class TopVideoMain : System.Web.UI.Page
{
protected System.Web.UI.WebControls.PlaceHolder ph2;
protected System.Web.UI.WebControls.PlaceHolder ph3;
protected System.Web.UI.WebControls.PlaceHolder ph;
protected System.Web.UI.WebControls.PlaceHolder ph4;
protected System.Web.UI.WebControls.ImageButton img;
protected System.Web.UI.WebControls.Image img1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string flcode=Request.QueryString["f"].ToString().Trim();
string cpcode = Request.QueryString["c"].ToString().Trim();//image code
string cpPath = Request.QueryString["p"].ToString().Trim();//image path
if (cpcode == "" || cpcode==string.Empty || cpcode==null && cpPath=="" || cpPath==string.Empty || cpPath== null)
{
CreateMediaPlayerEmbeddedControl(ph,flcode,500,500);// main video
CreateMediaPlayerEmbeddedControlImage(ph2,flcode,500,500);//main image video
	}
else
{
CreateMediaPlayerEmbeddedControlbyImage(ph3,flcode,cpcode,cpPath,500,500);//section video
ShowImage(flcode,cpcode,cpPath);			
}
}
}

private void ShowImage (string flcode, string cpcode, string cpPath)
{
img1.ImageUrl=cpPath;		
}

private void CreateMediaPlayerEmbeddedControlbyImage(PlaceHolder ph3,string flcode,string cpcode,string cpPath, int width, int height)
{
ph.Visible=false;
ph2.Visible=false;
ph3.Visible=true;
HtmlGenericControl result = new HtmlGenericControl();
ph3.Controls.Add(result);
HtmlGenericControl embed = new HtmlGenericControl();
result.Controls.Add(embed);
string location = Database.GetVideobycpCode(flcode,cpcode);
// Embed tag.
embed.TagName = "embed";
embed.Attributes.Add("type", "application/x-mplayer2");
embed.Attributes.Add("pluginspage", "http://www.microsoft.com/netshow/download/player.htm");
embed.Attributes.Add("name", "mediaPlayer");
embed.Attributes.Add("width", width.ToString());
embed.Attributes.Add("height", height.ToString());
embed.Attributes.Add("AllowChangeDisplaySize", "1");
embed.Attributes.Add("AllowSize", "0");
embed.Attributes.Add("AutoSize", "0");
embed.Attributes.Add("AutoStart", "1");
embed.Attributes.Add("DisplaySize", "4");
embed.Attributes.Add("EnableContextMenu", "0");
embed.Attributes.Add("Enabled", "1");
embed.Attributes.Add("InvokeURLs", "0");
embed.Attributes.Add("ShowCaptioning", "0");
embed.Attributes.Add("ShowStatusBar", "0");
embed.Attributes.Add("ShowControls", "1");
embed.Attributes.Add("WindowlessVideo", "1");
embed.Attributes.Add("uiMode", "None");
embed.Attributes.Add("src", location);
// Object tag
result.TagName = "object";
result.Attributes.Add("classid", "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95");
result.Attributes.Add("standby", "Loading Microsoft Windows Media Player components...");
result.Attributes.Add("codebase","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701");
result.Attributes.Add("type", "application/x-oleobject");
result.Attributes.Add("width", width.ToString());
result.Attributes.Add("height", height.ToString());
result.Controls.Add(new LiteralControl("<param name=\"AllowChangeDisplaySize\" value=\"1\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"AllowSize\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"AutoSize\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"AutoStart\" value=\"1\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"DisplaySize\" value=\"4\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"EnableContextMenu\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"Enabled\" value=\"1\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"Filename\" value=\"" + location + "\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"InvokeURLs\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"ShowCaptioning\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"ShowStatusBar\" value=\"0\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"ShowControls\" value=\"1\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"WindowlessVideo\" value=\"1\"/>"));
result.Controls.Add(new LiteralControl("<param name=\"uiMode\" value=\"None\"/>"));	}

private void CreateMediaPlayerEmbeddedControl(PlaceHolder ph, string flcode, int width, int height)
{
			HtmlGenericControl result = new HtmlGenericControl();
			ph.Controls.Add(result);
			HtmlGenericControl embed = new HtmlGenericControl();
			result.Controls.Add(embed);
			ph.Visible=true;
			string filetype ="v";
			string location = Database.getLocation(flcode,filetype);
			// Embed tag.
			embed.TagName = "embed";
			embed.Attributes.Add("type", "application/x-mplayer2");
			embed.Attributes.Add("pluginspage", "http://www.microsoft.com/netshow/download/player.htm");
			embed.Attributes.Add("name", "mediaPlayer");
			embed.Attributes.Add("width", width.ToString());
			embed.Attributes.Add("height", height.ToString());
			embed.Attributes.Add("AllowChangeDisplaySize", "1");
			embed.Attributes.Add("AllowSize", "0");
			embed.Attributes.Add("AutoSize", "0");
			embed.Attributes.Add("AutoStart", "1");
			embed.Attributes.Add("DisplaySize", "4");
			embed.Attributes.Add("EnableContextMenu", "0");
			embed.Attributes.Add("Enabled", "1");
			embed.Attributes.Add("InvokeURLs", "0");
			embed.Attributes.Add("ShowCaptioning", "0");
			embed.Attributes.Add("ShowStatusBar", "0");
			embed.Attributes.Add("ShowControls", "1");
			embed.Attributes.Add("WindowlessVideo", "1");
			embed.Attributes.Add("uiMode", "None");
			embed.Attributes.Add("src", location);
			// Object tag
			result.TagName = "object";
			result.Attributes.Add("classid", "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95");
			result.Attributes.Add("standby", "Loading Microsoft Windows Media Player components...");
			result.Attributes.Add("codebase","http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701");
			result.Attributes.Add("type", "application/x-oleobject");
			result.Attributes.Add("width", width.ToString());
			result.Attributes.Add("height", height.ToString());
			result.Controls.Add(new LiteralControl("<param name=\"AllowChangeDisplaySize\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AllowSize\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AutoSize\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AutoStart\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"DisplaySize\" value=\"4\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"EnableContextMenu\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"Enabled\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"Filename\" value=\"" + location + "\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"InvokeURLs\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowCaptioning\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowStatusBar\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowControls\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"WindowlessVideo\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"uiMode\" value=\"None\"/>"));
			
		}

		
		private void CreateMediaPlayerEmbeddedControlImage(PlaceHolder ph2, string flcode, int width, int height)
		{
			HtmlGenericControl result = new HtmlGenericControl();
			ph.Controls.Add(result);
			HtmlGenericControl embed = new HtmlGenericControl();
			result.Controls.Add(embed);
			ph2.Visible=true;
			string filetype = "i";
			string location = Database.getLocation(flcode,filetype);
			// Embed tag.
			embed.TagName = "embed";
			embed.Attributes.Add("type", "application/x-mplayer2");
			embed.Attributes.Add("pluginspage", "http://www.microsoft.com/netshow/download/player.htm");
			embed.Attributes.Add("name", "mediaPlayer");
			embed.Attributes.Add("width", width.ToString());
			embed.Attributes.Add("height", height.ToString());
			embed.Attributes.Add("AllowChangeDisplaySize", "1");
			embed.Attributes.Add("AllowSize", "0");
			embed.Attributes.Add("AutoSize", "0");
			embed.Attributes.Add("AutoStart", "1");
			embed.Attributes.Add("DisplaySize", "4");
			embed.Attributes.Add("EnableContextMenu", "0");
			embed.Attributes.Add("Enabled", "1");
			embed.Attributes.Add("InvokeURLs", "0");
			embed.Attributes.Add("ShowCaptioning", "0");
			embed.Attributes.Add("ShowStatusBar", "0");
			embed.Attributes.Add("ShowControls", "1");
			embed.Attributes.Add("WindowlessVideo", "1");
			embed.Attributes.Add("uiMode", "None");
			embed.Attributes.Add("src", location);
			// Object tag
			result.TagName = "object";
			result.Attributes.Add("classid", "clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95");
			result.Attributes.Add("standby", "Loading Microsoft Windows Media Player components...");
			result.Attributes.Add("codebase", 	"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701");
			result.Attributes.Add("type", "application/x-oleobject");
			result.Attributes.Add("width", width.ToString());
			result.Attributes.Add("height", height.ToString());
			result.Controls.Add(new LiteralControl("<param name=\"AllowChangeDisplaySize\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AllowSize\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AutoSize\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"AutoStart\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"DisplaySize\" value=\"4\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"EnableContextMenu\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"Enabled\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"Filename\" value=\"" + location + "\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"InvokeURLs\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowCaptioning\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowStatusBar\" value=\"0\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"ShowControls\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"WindowlessVideo\" value=\"1\"/>"));
			result.Controls.Add(new LiteralControl("<param name=\"uiMode\" value=\"None\"/>"));
		}

BottomVideoMain.aspx
public class BottomVideoMain : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.DataList dlImages;	
		protected System.Web.UI.WebControls.Label lblflcode;

		private void Page_Load(object sender, System.EventArgs e)
		{

			if (!IsPostBack)
			{
				string flcode=Request.QueryString["f"].ToString().Trim();
				lblflcode.Text = flcode.ToString().Trim();
				Getimages(flcode);			
			}
			else
			{
				string flcode = lblflcode.Text.ToString().Trim();
			Getimages(flcode);
			}
		}

		private void Getimages(string flcode)
		{
			SqlParameter[] parms = new SqlParameter[]
			{
				new SqlParameter("@flcode", SqlDbType.Char,4)
			};
			parms[0].Value = flcode;
					
			DataTable dt= Database.ExecuteQuery(Database.ConnString_eCurr, CommandType.StoredProcedure, "ecA_GetImages", parms);			
			dlImages.DataSource= dt.DefaultView;
			dlImages.DataBind();	
			dt.Clear();		
		}

		protected void dlImages_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
		{
			if(e.Item.ItemType ==ListItemType.Item || e.Item.ItemType ==ListItemType.AlternatingItem || e.Item.ItemType ==ListItemType.SelectedItem)
			{
			System.Web.UI.WebControls.ImageButton img = (System.Web.UI.WebControls.ImageButton)e.Item.FindControl("ibImages");
				string path = img.CommandArgument.ToString().Trim();
				img.ImageUrl= path.ToString().Trim();
			
			}
		
		
		}

		protected void ibImages_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			ImageButton ib = (ImageButton)sender;
			DataListItem item = (DataListItem)ib.Parent;
			string flcode = lblflcode.Text.ToString().Trim();
			Label lblcode =(Label)item.FindControl("lblcpcode");
			string cpcode=lblcode.Text.ToString().Trim();
			Label lblpath = (Label)item.FindControl("lblcpPath");
			string cppath = lblpath.Text.ToString().Trim();			
            Response.Redirect("TopVideoMain.aspx?f="+flcode+"&c="+cpcode+"&p="+cppath);
			// Response.Redirect("VideoMain.aspx?f="+flcode+"&c="+cpcode+"&p="+cppath);
						
		}

I am able to see the top video frame and the bottom when the videomain page loads, but when i click on an image- The top frame video doesnt stop but a new windows media player get created in the bottom frame and all the images are lost.
I want the upper frame to start playing the video associated with the image selected.
Thank you in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.