problem with showing youtube on my page.

Rate It (1)

Last post 06-18-2009 1:27 AM by prabhuch85. 49 replies.

Sort Posts:

  • Re: problem with showing youtube on my page.

    05-18-2009, 4:51 AM
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    check your email that you use to get notifications from this forum. I sent you an email.

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-19-2009, 2:18 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     hi,

     

    just one question...i tried to use ListView because datalist does not support paging..It works fine, howver i noticed that if i put listview inside update panel and when i click to other page, the imgaes are not visible. Without update panle images are shown if you click to go to other page..

    Do you know how to solve this, or maybe how to make paging and delete button in datalist?

  • Re: problem with showing youtube on my page.

    05-19-2009, 2:59 PM
    Answer
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    instead of the updatepanel make use of the tablepager jQuery plugin. Works great! Take a look here: http://tablesorter.com/docs/.

    For the DataList deleted button you should simply add a button with the CommandName="Delete" (should be exactly that value). Take a look at this documentation for sample code: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.deletecommand.aspx.

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-19-2009, 3:21 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     ok, will use jquery...

    i acutally used code from msdn...i posted the problem here even though it should run...but it's not..

    http://forums.asp.net/t/1424549.aspx

  • Re: problem with showing youtube on my page.

    05-21-2009, 12:47 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     i found code to my problem and it's working perfectly :)

     

    <script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    function EndRequestHandler(sender, args) {
    if (args.get_error() == undefined) {
    alertTest();
    }
    }

    function alertTest() {
    $(document).ready(function() {
    $('#dodo a').each(function(i) {
    $(this).after($('<img/>').attr('src', $.jYoutube($(this).attr('href'))));
    });
    });
    }

    alertTest();
    </script>
      

     

     But now im facing new problem...showing the video from URL link on my detail page..
    Is there a jquery for that too? a tutorial perhaps on how to play video of URL link on my page?

  • Re: problem with showing youtube on my page.

    05-21-2009, 2:53 PM
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    looks to me you're after this: http://malsup.com/jquery/media/#.

    Grz, Kris.

    PS: whenever you come up with a new question, just start a new thread. This makes it easier for others to later find valuable information instead of having to face a lot of pages before finding something he's interested in.

  • Re: problem with showing youtube on my page.

    05-21-2009, 3:27 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     hm..strange..it's not working for me...i copied jquery-media file, and did as said here, but i only get link...not the video...

    I copied the demo and it's working...but i want to open video on the same page...actually so that video loads on page load.

    ok..i will open new thread next time...but i think i should keep this opened as it is similar to my first problem :)


  • Re: problem with showing youtube on my page.

    05-21-2009, 4:09 PM
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    can you show the relevant parts of your code and what's different compared to the samples?

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-21-2009, 4:17 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     this is my datalist:

     

    <script type="text/javascript">
    $(function() {
    //$.fn.media.mapFormat('avi','quicktime');
    // this one liner handles all the examples on this page
    $('.media').media();
    });
    </script>

    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
    DataKeyNames="VideoId" CssClass="RC-Datalist-Video-Detail"
    DataSourceID="VideoDetail" GridLines="None">
    <Fields>
    <asp:TemplateField HeaderText="VideoPovezava" SortExpression="VideoPovezava"
    ShowHeader="False">
    <ItemTemplate>
    <a class="media" href="<%# Bind("VideoPovezava") %>">
     <asp:label ID="label1" text='<%# Bind("VideoPovezava") %>' runat="server"></asp:Label>
    </a>
    </ItemTemplate>
    </asp:TemplateField>
    </Fields>
    </asp:DetailsView>

     so im trying to do that when you come to this page the video would load on page load, so the user can watch here without doing anymore clicks.

     

  • Re: problem with showing youtube on my page.

    05-22-2009, 3:02 AM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     how about to write something in code behind so that it only reads last 10 or 15 caracters from the database cell?

    so it would only read  Fs6EjqBzNpM instead of this: http://www.youtube.com/watch?v=Fs6EjqBzNpM

    this could solve my problem real quick..

    I found this but i guess im doing something wrong:

     

     foreach (DetailsViewRow row in DetailsView1.Rows)
    {

    string Label4 = "http://www.youtube.com/watch?v=Fs6EjqBzNpM";

    string last = Label4.Substring(Label4.LastIndexOf('=') - 1);

    }
    }
      
  • Re: problem with showing youtube on my page.

    05-22-2009, 4:07 AM
    Answer
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    actually I would only keep the unique identifiers myself in the database not the whole url. That part's best kept somewhere in 1 position as say for example youtube would become something else like googletube you won't have to go through the task of updating that in the database and risking to code in other places that's dependant on certain substring criteria.

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-22-2009, 4:12 AM
    Answer
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    on this page they apparently use that media plugin for playing a youtube file:

    http://malsup.com/jquery/media/video.html

    <a class="media {width:450, height:380, type:'swf'}" href="http://youtube.com/v/TyvN59L4hJU">Youtube Video (SWF)</a>

    And using in script:

    $('a.media').media();

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-22-2009, 12:08 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     

    XIII:

    Hi,

    actually I would only keep the unique identifiers myself in the database not the whole url. That part's best kept somewhere in 1 position as say for example youtube would become something else like googletube you won't have to go through the task of updating that in the database and risking to code in other places that's dependant on certain substring criteria.

    Grz, Kris.

    actually this is good idea...so is the script written above the right way to do it on insert form or should try different?

  • Re: problem with showing youtube on my page.

    05-22-2009, 12:21 PM
    • All-Star
      122,552 point All-Star
    • XIII
    • Member since 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 13,585
    • ASPInsiders
      Moderator
      TrustedFriends-MVPs

    Hi,

    Urko:
    ...so is the script written above the right way

    Do you mean the code of the datalist you wrote? If so I guess you also have to add the extra youtubelink in the urls because now you're only binding the unique identifier. Both jquery scripts apparently need the full url path (which makes sense).

    Grz, Kris.

  • Re: problem with showing youtube on my page.

    05-22-2009, 12:33 PM
    • Member
      37 point Member
    • Urko
    • Member since 10-18-2006, 11:44 AM
    • Posts 112

     actually i was thinking in code behind...

    here is my insert form.... 

      

            protected void VideoLinkVnos(object sender, EventArgs e)
    {

    // Determine the currently logged on user's UserId
    MembershipUser currentUser = Membership.GetUser();

    Int32 currentUserId = (Int32)currentUser.ProviderUserKey;

    string getLastPartURL = "@VideoPovezava";
    getLastPartURL = getLastPartURL.Split('=')[1];

    string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\Orozje-Reloading-Center.mdb";
    OleDbConnection conn = new OleDbConnection(connectionString);
    conn.Open();
    OleDbCommand cmd = new OleDbCommand();
    cmd.Connection = conn;
    cmd.CommandText = "INSERT INTO VIDEO_MOJI(VideoNaslov, VideoPovezava, UserId) VALUES(?, ?, ?)";
    cmd.Parameters.AddWithValue("@VideoNaslov", VideoNaslovTextBox.Text.Trim());
    cmd.Parameters.AddWithValue("@VideoPovezava", getLastPartURL);
    cmd.Parameters.AddWithValue("@UserId", currentUserId);

    cmd.ExecuteNonQuery();

    conn.Close();

    // "Reset" TextBoxes
    VideoNaslovTextBox.Text = string.Empty;
    VideoPovezavaTextBox.Text = string.Empty;
    Uspeh.Text = "Video je uspešno dodan!";

    }
     

     VideoPovezava holds the URL...so i tried to write that code above to insert form but it's not entering to db now.

     

     

Page 3 of 4 (50 items) < Previous 1 2 3 4 Next >