Add button to save video
<asp:Button ID="buttonInsert" runat="server" Text="Add video" OnClick="buttonInsert_Click"/>
Take the hidden field to hold the image value.
<asp:HiddenField ID="VideoId" runat="server" ClientIDMode="Static" />
Enter javascript code as follows to get image
<script type="text/javascript"> $(document).ready(function () { $("#buttonInsert").click(function () { var youtubeid = $("#textBoxScript").val().match(/[\w\-]{11,}/)[0]; $("#VideoId").val("http://i1.ytimg.com/vi/" + youtubeid + "/0.jpg") }); }); </script>
Save the value of hidden settings in the database.
protected void buttonInsert_Click(object sender, EventArgs e) { try { string ThumbnailImage = VideoId.Value;
source share