<asp:TextBox ID="txtvideourl" onclick="hide_video();" runat="server" Width="258px"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfv_txtvideourl" runat="server" ControlToValidate="txtvideourl"
ErrorMessage="Please Enter Video URL" Display="None" SetFocusOnError="true" ValidationGroup="submitvideo"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vce_txtvideourl" runat="server" TargetControlID="rfv_txtvideourl">
</ajaxToolkit:ValidatorCalloutExtender>
protected void btnVideo_Click(object sender, EventArgs e)
{
string videourl = string.Empty, filename = string.Empty;
try
{
if (txtvideourl.Text.Contains("http://youtu.be"))
{
videourl = txtvideourl.Text;
string[] arr = new string[5];
arr = videourl.Split('/');
filename = arr[3];
if (ObjBll.Opertaions_on_Videos("", txtVideoName.Text, filename, "True", "Insert"))
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Warning", "alert(' Submited Successfully..')", true);
iframe_Video.Visible = true;
iframe_Video.Attributes["src"] = "http://www.youtube.com/embed/" + filename;
bind_data();
txt_Clear();
}
}
else
{
txtvideourl.Focus();
lbl_urlmsg.Text = "Enter Valid URL";
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message.ToString();
}
<asp:RequiredFieldValidator ID="rfv_txtvideourl" runat="server" ControlToValidate="txtvideourl"
ErrorMessage="Please Enter Video URL" Display="None" SetFocusOnError="true" ValidationGroup="submitvideo"></asp:RequiredFieldValidator>
<ajaxToolkit:ValidatorCalloutExtender ID="vce_txtvideourl" runat="server" TargetControlID="rfv_txtvideourl">
</ajaxToolkit:ValidatorCalloutExtender>
protected void btnVideo_Click(object sender, EventArgs e)
{
string videourl = string.Empty, filename = string.Empty;
try
{
if (txtvideourl.Text.Contains("http://youtu.be"))
{
videourl = txtvideourl.Text;
string[] arr = new string[5];
arr = videourl.Split('/');
filename = arr[3];
if (ObjBll.Opertaions_on_Videos("", txtVideoName.Text, filename, "True", "Insert"))
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Warning", "alert(' Submited Successfully..')", true);
iframe_Video.Visible = true;
iframe_Video.Attributes["src"] = "http://www.youtube.com/embed/" + filename;
bind_data();
txt_Clear();
}
}
else
{
txtvideourl.Focus();
lbl_urlmsg.Text = "Enter Valid URL";
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message.ToString();
}
No comments:
Post a Comment