Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 14th, 2012, 02:02 PM
Authorized User
Join Date: Jan 2009
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Post how to set string value to object param


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.

objectwidth="480"height="385"><paramname="movies"value='<%# urllnk%>'/>

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);
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}).*",
if (regexMatch.Success)
return"http://www.youtube.com/v/" + regexMatch.Groups[1].Value +
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
Old March 15th, 2012, 06:36 AM
Authorized User
Join Date: Jan 2011
Posts: 86
Thanks: 1
Thanked 12 Times in 12 Posts


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.
 public string urllnk { get; set; }
Once you've done that you could use it as an inline expression.

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.