Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 14th, 2012, 02:02 PM
Authorized User
Points: 91, Level: 1
Points: 91, Level: 1 Points: 91, Level: 1 Points: 91, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Post how to set string value to object param

Hello

In my design.aspx page i am taking an object to display youtube link:Iam entering the youtube link in textbox and when i click the button i need to play that video.

<asp:TextBoxID="txt1"runat="server"Width="600px"></asp:TextBox>
<
asp:ButtonID="btn1"runat="server"Text="youtube"Width="114px"onclick="btn1_Click"/
<
objectwidth="480"height="385"><paramname="movies"value='<%# urllnk%>'/>
<paramname="allowFullScreen"value="true"/>
<paramname="allowscriptaccess"value="always"/>

in my code behind class

protectedvoid btn1_Click(object sender, EventArgs e)
{
string url = txt1.Text;
if (url.Contains("youtube.com"))
{
string urllnk = GetYouTubeID(url);
}
else
{
Response.Write("This URL is not a valid YOUTUBE video link because it does not contain youtube.com in it");
}
}
privatestring GetYouTubeID(string youTubeUrl)
{Match regexMatch = Regex.Match(youTubeUrl, "^[^v]+v=(.{11}).*",
RegexOptions.IgnoreCase);
if (regexMatch.Success)
{
return"http://www.youtube.com/v/" + regexMatch.Groups[1].Value +
"&hl=en&fs=1";
}
return youTubeUrl;
}

how to bind the textbox value to param and how to display the video

getting error:The name urllnk doennot exist in the current context
  #2 (permalink)  
Old March 15th, 2012, 06:36 AM
Authorized User
Points: 448, Level: 7
Points: 448, Level: 7 Points: 448, Level: 7 Points: 448, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts
Default

Hi,

the name urllnk indeed does not exist in the current context because you need to declare urllink either as a public property or protected variable with page scope.
Code:
 public string urllnk { get; set; }
Once you've done that you could use it as an inline expression.
Code:
<%=urllnk%>'/>
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 14 - pg 517 - Item 9 (Object reference not set to an instance of an object. ) jkoyle BOOK: Beginning ASP.NET 4 : in C# and VB 5 August 25th, 2011 08:50 AM
Chap 13 pg448: Object reference not set to an instance of an object tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 15 August 8th, 2009 06:14 AM
Object variable not set or With Block not set brucechess BOOK: Beginning VB.NET Databases 1 March 3rd, 2009 07:30 AM
String xsl:param as XPath expression Vx XSLT 4 September 5th, 2006 10:18 AM
Passing as object as a Param to a Web User Control MixedCode General .NET 2 December 8th, 2004 11:36 AM



All times are GMT -4. The time now is 06:42 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.