views:

20

answers:

2

Hi friends

This is a very simple complexive query that I have. I need the solution. I have a youtube link

<----- width="480" height="350"><---- src="http://www.youtube.com/v/OORDOd6wRrE&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="350"><---><----->

this is the modified link. Well, my problem is, that I want to change the size of video, means in the whole string I want to replace width="480" with width="250" and height="350" with height="250"

I want to change these parameters programmatically using ASP.Net

Thanks

A: 

So what seems to be the problem?

This worked for me:

<object height="250" width="250">
    <param name="movie" value="http://www.youtube.com/v/OORDOd6wRrE"&gt; 
    <param name="allowfullscreen" value="true"> 
    <param name="wmode" value="opaque"> 
    <embed src="http://www.youtube.com/v/OORDOd6wRrE" type="application/x-shockwave-flash" allowfullscreen="true" wmode="opaque" height="250" width="250"> 
</object>

However you should change the height and width according to the H/W ratio in order for the movie not to become distorted.

EDIT:

After seeing OPs answer I think I understand what he's trying to do. For this my suggestion is to use regular expressions like so:

temp = Regex.Replace(strInput, "width=\"\d*\"", "width=\"250\"");
result = Regex.Replace(temp, "height=\"\d*\"", "height=\"250\"");

Also, check out the following tutorial: Regular Expressions in ASP.NET.

the_void
Thanks for your quick reply.I know that, I want to change these parameters by programmatically in ASP.Net.Thanks
Kamlesh
You don't make the source of your problem clear enough. However, it's as simple as: `myLabel.Text = "<object height='250' width='250'><param name='movie' value='http://www.youtube.com/v/OORDOd6wRrE'> <param name='allowfullscreen' value='true'><param name='wmode' value='opaque'><embed src='http://www.youtube.com/v/' + myVideoID type='application/x-shockwave-flash' allowfullscreen='true' wmode='opaque' height='250' width='250'></object>";`
the_void
A: 

I got my solution.

Define one user define function
private bool IsInt(string IntValue)
{
      try
      {
            int iValue = int.Parse(IntValue);
      }
      catch (Exception Ex) { return false;}

     return true;
}

    string str=txt_Links.Text;
    string lastNo = "";
    bool firstNoFound = false;
    for (int strIdx = 0; strIdx <= str.Length - 1; strIdx++)
    {
        if (IsInt(str.Substring(strIdx, 1)) == true)
        {
            lastNo = lastNo + str.Substring(strIdx, 1);
            firstNoFound = true;
        }
        else
        {
            if (firstNoFound == true)
            {
                //Page.Title = lastNo;
                str = str.Replace("width=\"" + lastNo + "\"", "width=\"250\"").Replace("height=\"" + lastNo + "\"", "height=\"250\"");
                lastNo = "";
                firstNoFound = false;
            }
        }
    }

    Response.Write(str);
Kamlesh
This is definitely `NOT` the way to do this! Use `regular expressions` like in my updated answer.
the_void
Thank you very much. I will try your solution. That time, my problem solved by this code. So that put it on. This could be a wrong way but "IT IS 100% WORKING". Thank you once again.
Kamlesh