Solved

Pass Data from Pageload to aspx

Posted on 2011-02-14
7
664 Views
Last Modified: 2012-05-11
I'm trying to figure out how to simply pass data from pageload codebehind into an html page


what I was originally thinking was function, but that can't be in the pageload

but something like this

<MediaSource><%= GetMedia() %></MediaSource>

codebehind

Function GetMedia() as string

End function

But I think there's probably a better way of doing this

input greatly appreciated


full code embedded











   
<object data="data:application/x-silverlight," type="application/x-silverlight"



width="100%" height="100%"

	    >
            <param name="source" value="MediaPlayerTemplate.xap"/>
            <param name="onerror" value="onSilverlightError" />
            <param name="autoUpgrade" value="true" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="enableHtmlAccess" value="true" />

            <param name="enableGPUAcceleration" value="true" />

            <param name="initparams" value='playerSettings = 
                        <Playlist>
                            <AutoLoad>false</AutoLoad>
                            <AutoPlay>false</AutoPlay>
                            <AutoRepeat>false</AutoRepeat>
                            <DisplayTimeCode>false</DisplayTimeCode>
                            <EnableOffline>true</EnableOffline>
                            <EnablePopOut>false</EnablePopOut>

                            <EnableCaptions>true</EnableCaptions>
                            <EnableCachedComposition>true</EnableCachedComposition>
                            <StretchNonSquarePixels>StretchToFill</StretchNonSquarePixels>
                            <StartMuted>false</StartMuted>
                            <StaysFullScreenWhenUnfocused>true</StaysFullScreenWhenUnfocused>

                            <StartWithPlaylistShowing>false</StartWithPlaylistShowing>


                            <Items>
                                
								<PlaylistItem>
									<AudioCodec>WmaProfessional</AudioCodec>
									<Description></Description>
									<FileSize></FileSize>
									<IsLive>false</IsLive>
									<IsAdaptiveStreaming>false</IsAdaptiveStreaming>
									<MediaSource>Mov_21_24_42_Jan_14.wmv</MediaSource>
									<ThumbSource></ThumbSource>
									<Title>Mov_21_24_42_Jan_14</Title>
									<DRM>false</DRM>
									<VideoCodec>VC1</VideoCodec>
									<FrameRate>30.00012000048</FrameRate>
									<Width>288</Width>
									<Height>384</Height>
									<AspectRatioWidth>0.75</AspectRatioWidth>
									<AspectRatioHeight>1</AspectRatioHeight>
								</PlaylistItem>
                            </Items>
                        </Playlist>'/>       
            <!--  unused valid silverlight init parameters
            <param name="enableFrameRateCounter" value="bool" />
            <param name="enableRedrawRegions" value="bool" />
            <param name="maxFrameRate" value="int" />
            <param name="allowHtmlPopupWindow" value="bool"/>
            <param name="background" value="colorValue"/>
            <param name="splashScreenSource" value="uri"/>
            <param name="fullScreen" value="bool"/>
            <param name="onFullScreenChanged" value="functionname"/>
            <param name="onResize" value="functionname"/>
            <param name="onSourceDownloadComplete" value="functionname"/>
            <param name="onSourceDownloadProgressChanged" value="functionname"/>
            <param name="windowLess" value="bool"/>
             --> 

             <div onmouseover="highlightDownloadArea(true)" onmouseout="highlightDownloadArea(false)">
                    <img src="" style="position:absolute;width:100%;height:100%;border-style:none;" onerror="this.style.display='none'"/>
                    <img src="Preview.png" style="position:absolute;width:100%;height:100%;border-style:none;" onerror="this.style.display='none'"/>                                            
                    <div id="overlay" class="fadeLots" style="position:absolute;width:100%;height:100%;border-style:none;background-color:white;"/>
                    <table width="100%" height="100%" style="position:absolute;">
                        <tr><td align="center" valign="middle"><img src="http://go2.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"/></td></tr>
                    </table>                   
                    <a href="http://go2.microsoft.com/fwlink/?LinkID=149156">
                        <img src="" class="fadeCompletely" style="position:absolute;width:100%;height:100%;border-style:none;" alt="Get Microsoft Silverlight"/>
                    </a>                   
             </div>             
        </object>

Open in new window

0
Comment
Question by:TheWebGuy38
  • 3
  • 3
7 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 34894238
u cud place a literal & frm server side say Literal1.text = GetMedia().
0
 

Author Comment

by:TheWebGuy38
ID: 34894262
I Noticed I could do this:

<%=Variable %>

then before pageload I can do

Public Variable as string = "test data"

but can't do that in the page load


hrmmm, literal might work
0
 
LVL 8

Accepted Solution

by:
PagodNaUtak earned 500 total points
ID: 34894274
You can actually use <MediaSource><%= GetMedia() %></MediaSource>

just add this code in pageload

page.DataBind()
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:TheWebGuy38
ID: 34894303
yes, a literal does work :)

would be nice to know if you can do it inline as well
0
 

Author Comment

by:TheWebGuy38
ID: 34894371
PagodNaUtak

what does the code look like in the pagelload?
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 34894696
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 34894703
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now