473,414 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

how to set a object param in code

Hi,

I have the Windows media object placed on a web page.

Since its not a .net component (its a com object) I have placed the code in
the html source of the page. The problem I am having is that I get the url
of the video file i want to play in the asp.net code (form_load event). How
do I pass this value into the html...

Ie :

<html>
<html>
<object id=msnVwmp class=msnVa
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 style="width: 141px;
height: 141px">
<param name=uiMode value=full>
<param name=enableContextMenu value=false>
<param name=stretchToFit value=false>
<param name=windowlessvideo value=false>
<param name=url value="">
</object>
</htm>

In my ASPX Code behind file:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

strFileName = http://myurl.com/sample.avi

End Sub

Somehow I need to get the strFileName in my code behind file, into the param
url value field....

Thanks
Aug 3 '06 #1
4 7644
Hi Aussie,

To set the media player's property from server-side code, you have two
options:

1) Declare a public property to return the video url:

public string VideoUrl
{
get
{
return "http://localhost/1.avi";
}
}

Then modify the WebForm:

<object id=msnVwmp class=msnVa
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 style="width:
141px;
height: 141px">
<param name=uiMode value=full>
<param name=enableContextMenu value=false>
<param name=stretchToFit value=false>
<param name=windowlessvideo value=false>
<param name=url value="<%= VideoUrl %>">
</object>

This way, the generated media player's declaration will get updated url
property value from server-side code.

2) Register a startup javascript function to control the media player:

protected void Button1_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "mp",
"form1.msnVwmp.url='http://mysite/1.avi';", true);
}

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 4 '06 #2
Sorry for the most basic of basic questions...

Do i put the public string... code into a class of its own, or in the code
behind file?

Thanks
"Walter Wang [MSFT]" <wa****@online.microsoft.comwrote in message
news:nu**************@TK2MSFTNGXA01.phx.gbl...
Hi Aussie,

To set the media player's property from server-side code, you have two
options:

1) Declare a public property to return the video url:

public string VideoUrl
{
get
{
return "http://localhost/1.avi";
}
}

Then modify the WebForm:

<object id=msnVwmp class=msnVa
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 style="width:
141px;
height: 141px">
<param name=uiMode value=full>
<param name=enableContextMenu value=false>
<param name=stretchToFit value=false>
<param name=windowlessvideo value=false>
<param name=url value="<%= VideoUrl %>">
</object>

This way, the generated media player's declaration will get updated url
property value from server-side code.

2) Register a startup javascript function to control the media player:

protected void Button1_Click(object sender, EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "mp",
"form1.msnVwmp.url='http://mysite/1.avi';", true);
}

Hope this helps. Please feel free to post here if anything is unclear.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 4 '06 #3
Hi Aussie,

If you are using Single-File Pages, you can use embedded server-side code
block:

<script runat="server">
public string VideoUrl
...
</script>

In a single-file page, the markup, server-side elements, and event-handling
code are all in a single .aspx file. When the page is compiled, the
compiler generates and compiles a new class that derives from the base Page
class or a custom base class defined with the Inherits attribute of the @
Page directive.

If you are using Code-Behind Page Model, you need to put the function in
the code file. The code file contains a partial class. When the page is
compiled, ASP.NET generates a partial class based on the .aspx file; this
class is a partial class of the code-behind class file. The generated
partial class file contains declarations for the page's controls. This
partial class enables your code-behind file to be used as part of a
complete class without requiring you to declare the controls explicitly.

References:
==========
#ASP.NET Web Page Code Model
http://msdn2.microsoft.com/en-us/library/015103yb.aspx

#ASP.NET Page Class Overview
http://msdn2.microsoft.com/en-us/library/ms178138.aspx

#Code Render Blocks
http://msdn2.microsoft.com/en-us/library/k6xeyd4z.aspx

#partial (C# Reference)
http://msdn2.microsoft.com/en-us/library/wbx7zzdd.aspx

Hope this helps. Please feel free to post here if anything is unclear.
Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 6 '06 #4
Hi Aussie,

Just noticed your another post about "public string", I'm sorry I didn't
notice that you're coding the web application in VB.NET.

Anyway, the reference articles in my previous post will still be useful for
you to understanding the "Code Render Blocks". If you need anything else,
please feel free to post here.

For the VB.NET syntax of the property I suggested, you can use:

Public ReadOnly Property VideoUrl()
Get
Return "http://localhost/1.avi"
End Get
End Property

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eyal | last post by:
Hey, I would appriciate if anyone can help on this one: I have a java object/inteface having a method with a boolean parameter. As I'm trying to call this method from a javascript it fails on...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
2
by: John Mullin | last post by:
We are having a problem which appears similar to a previous posting: http://groups.google.com/groups?hl=en&lr=&frame=right&th=d97f552e10f8c94c&seekm=OZw33z9EDHA.2312%40TK2MSFTNGP10.phx.gbl#link1 ...
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
16
by: anonymous.user0 | last post by:
The way I understand it, if I have an object Listener that has registered as a listener for some event Event that's produced by an object Emitter, as long as Emitter is still allocated Listener...
0
by: NDK | last post by:
Ok so I have an html page with an embedded excel object. I load some information into the object from a spreadsheet. (works perfectly) I would like to be able to change the background of a few...
3
by: Brad | last post by:
I have several movies being presented to the web on a single page and each one is dependant on a link selected. On the .aspx page I have the following code for a single movie. ...
1
by: KhoaNguyen | last post by:
i have two classes..one is a base and the other is inherited from the base class Below is my code -------ConnectionProvider class--------------------- using System; using...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.