I am trying to center the radmediaplayer telerik control, but to no avail. Please help thank you.
<asp:Panel ID="pnlModal3" runat="server" role="dialog" CssClass="modal fade">
<asp:Panel ID="pnlInner3" runat="server" CssClass="modal-dialog" >
<asp:Panel ID="pnlContent4" CssClass="modal-content" runat="server">
<asp:Panel runat="server" class="modal-header">
<h4 class="modal-title" >Clip Player</h4>
</asp:Panel>
<asp:panel runat="server" class="modal-body">
<telerik:RadScriptManager runat="server" ID="RadScriptManager2" />
<div style="text-align:center;">
<telerik:RadMediaPlayer ID="ClipPlayer" runat="server" AutoPlay="true" Height="400px" Width="400px" DestroyOnClose ="true">
</telerik:RadMediaPlayer>
</div>
</asp:panel>
<asp:panel runat="server" class="modal-footer">
<asp:Button ID="Button4" runat="server" Text="Close" OnClick="btnClose_Click" class="btn btn-default"/>
</asp:panel>
</asp:Panel>
</asp:Panel>
</asp:Panel>
First, two generic issues:
RadMediaPlayer does not have a DestroyOnClose property. RadWindow has.
The script manager should be your first control inside the .
Back to your question - what exactly is not working? have you tried setting margin: auto to the div element that is the media player control? This worked for me in a basic setup:
<div>
<telerik:RadMediaPlayer ID="ClipPlayer" CssClass="centeredPlayer" runat="server" AutoPlay="true" Height="400px" Width="400px">
</telerik:RadMediaPlayer>
</div>
and
.centeredPlayer
{
margin: auto;
}
If it does not work for you, inspect the rendered HTML to see what CSS is in play. Substitute RadMediaPlayer with a simple div and center that first.
Related
I'm trying to set focus on a control after Postback but its not working. below are the details.
I have some code inside a Panel. Panel will be open closed using ajax.
There is a radio button inside panel ... Once I click the radio button, i want to focus on that control but it goes to start of the page due to post back.
I tried
1. SetFocus(controlID);
2. controlID.Focus();
3. set focus to control in javascript also
but no solution working.
This is a long page ... I have more panels in it. Not sure why my solutions are not working.
Attached my code below:
<Panel> first panel comes here...</Panel>
<div class="demoarea">
<asp:Panel ID="pnl_2_Header" runat="server" CssClass="collapsePanelHeader" Height="30px">
<div style="padding:5px; cursor: pointer; vertical-align: middle;">
<div style="float: left;">User's Information</div>
<div style="float: left; margin-left: 20px;">
<asp:Label ID="lbl_2_Header" runat="server" Visible="False">(Show Details...)</asp:Label>
</div>
<div style="float: right; vertical-align: middle;">
<asp:ImageButton ID="img_2_Header" runat="server" ImageUrl="~/images/expand_blue.jpg" AlternateText="(Show Details...)" Visible="False"/>
</div>
</div>
</asp:Panel>
<asp:Panel ID="pnl_2" runat="server" CssClass="collapsePanel" Height="0" BorderStyle="solid" BorderWidth="1">
<table width="100%" style="text-align:left;font-weight:300;" cellpadding="7">
<tr valign="top">
<td style="width:50%;">
School in Primary 6 :
<br /><br />
<asp:RadioButton ID="rdoPri1" runat="server"
Text="sometext" GroupName="pri" value="1"
AutoPostBack="True" oncheckedchanged="rdoPri1_CheckedChanged" /> <br />
<asp:RadioButton ID="rdoPriOther" runat="server" Text="Others"
GroupName="pri" value="2" AutoPostBack="True"
oncheckedchanged="rdoPriOther_CheckedChanged" />
<asp:TextBox ID="txtPriOther" CssClass="txt" Width="50%" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqPriOther" ValidationGroup="pnl_2" Visible="false" runat="server" ControlToValidate="txtPriOther" Text="*" ErrorMessage="*" SetFocusOnError="true"></asp:RequiredFieldValidator>
</td>
</tr>
</table>
</asp:Panel>
</div>
<ajaxToolkit:CollapsiblePanelExtender ID="cpe_2" runat="Server"
TargetControlID="pnl_2"
ExpandControlID="pnl_2_Header"
CollapseControlID="pnl_2_Header"
Collapsed="True"
TextLabelID="lbl_2_Header"
ImageControlID="img_2_Header"
ExpandedText="(Hide Details...)"
CollapsedText="(Show Details...)"
ExpandedImage="~/images/collapse_blue.jpg"
CollapsedImage="~/images/expand_blue.jpg"
SuppressPostBack="true"
SkinID="CollapsiblePanelDemo" />
<Panel> 3rd Panel </Panel>
...
Code behind:
protected void rdoPri1_CheckedChanged(object sender, EventArgs e)
{
-- Some code here --
//SetFocus(pnl_2);
rdoPri1.Focus();
}
Web form server control event will trigger postback when Autopostback is set to true. It means your Set focus will not be working expected after one of the controls triggered postback.
So, my personal opinion, it you need such a UI/UX design, I would suggest to use client script instead.
Add the same control.Focus() or setfocus in page load, and add conditions like if needed
//in page load
if (rdoButton1.Checked) {//setfocus here}
Here is my code:
<asp:WebPartZone ID="Zone1" runat="server" Width="100%" PartChromeType="None" Padding="0" PartStyle-CssClass="NoPadding"
PartStyle-BackColor="Transparent" BackColor="Transparent" PartChromeStyle-BackColor="Transparent">
<PartStyle BackColor="Transparent"></PartStyle>
<CloseVerb Visible="false" />
<MinimizeVerb Visible="false" />
<ZoneTemplate>
<div class="demo">
<p>Procedure Queues</p>
</div>
<div class="demoBottom">
<div class="divPortletContent">
<br />
<asp:DataList ID="dlProcedureQueues" runat="server" >
<ItemTemplate>
<asp:HyperLink ID="lbProcedureQueues" runat="server" Text='<%# Eval("site_nm") %>' NavigateUrl='<%# Eval("site_url") %>' />
</ItemTemplate>
</asp:DataList>
</div>
</div>
</ZoneTemplate>
</asp:WebPartZone>
The text from <div class="demo"><p>Procedure Queues</p></div> is miising and it works if I put it outside of webpart. Also, I am loosing all the css styles when placed inside webpart's ZoneTemplate.
Any ideas?? Thanks in advance.
Let me answer my own question. From what I found out, ZoneTemplate only considers the asp controls (including user controls) as web parts and ignores all the html.
I am developing a page to display some videos with asp .net fw3.5. The page will display a list of videos with thumbnails. When the user clicks a video thumb i will open a popup and show the video in the popup. There will be a rating control in the video.the user can vote for the video using the ajax rating control. the popup should remain shown after rating control is clicked.
I have done some of the coding but the problem is I cant get the current rating of the rating control without doing a postback. I can make the popup always visible by using an update panel but if i do so the close button of the modal popupextender doesnt work and i cannot close the modal popup. Here is my related code portion:
<asp:Button ID="Button1" runat="server" Style="display: none" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" OkControlID="btnOkay"
TargetControlID="Button1" PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader"
Drag="true" BackgroundCssClass="ModalPopupBG">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="PopupCss">
<table style="width: 100%; height: 100%;">
<tr>
<td>
<div id="mediaplayer">
JW Player goes here</div>
<script type="text/javascript">
jwplayer("mediaplayer").setup({
flashplayer: "jwplayer/player.swf",
file: "<%=videoName %>",
image: "<%=videoThumb %>",
width: "100%",
height: "100%"
});
</script>
</td>
<td valign="top" align="left" style="text-align: left;">
<div class="fb-like" data-send="true" data-layout="button_count" data-show-faces="true">
</div>
<br />
<div class="fb-comments" data-href="<%=videoLink%>"
data-num-posts="3" data-width="470">
</div>
<br />
<br />
<br />
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2">
</a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4">
</a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style">
</a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f61d99d08697325"></script>
<!-- AddThis Button END -->
<br />
<br />
<asp:Rating ID="Rating1" runat="server" MaxRating="5" StarCssClass="ratingStar" FilledStarCssClass="ratingStarFilled"
AutoPostBack="true" OnChanged="VideoRatingChanged" EmptyStarCssClass="ratingStarEmpty"
WaitingStarCssClass="ratingStarEmpty">
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%=videoId%>' />
</asp:Rating>
  (<%=voteCount%>)
<br />
Minder Score:
<%=minderScore %>
<br />
<div class="Controls" style="text-align: left;">
<input id="btnOkay" type="button" value="Kapat" />
</div>
</td>
</tr>
</table>
</asp:Panel>
How can i manage to have the desired functionality.
Any help will be appreciated.
Thanks
The easiest way to do it is to warp it with an UpdatePanel
<br />
<asp:UpdatePanel runat="server" ID="up1">
<ContentTemplate>
<asp:Rating ID="Rating1" runat="server" MaxRating="5" StarCssClass="ratingStar" FilledStarCssClass="ratingStarFilled"
AutoPostBack="true" OnChanged="VideoRatingChanged" EmptyStarCssClass="ratingStarEmpty"
WaitingStarCssClass="ratingStarEmpty">
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%=videoId%>' />
</asp:Rating>
</ContentTemplate>
</asp:UpdatePanel>
For the part of total vote count, if you like to include it inside the UpdatePanel you need to change it with asp:literal controls, and render inside this control the results. So if you like to include this code inside the UpdatePanel, for automatic update them,
  (<%=voteCount%>)
<br />
Minder Score:
<%=minderScore %>
you need to write it as
  (<asp:Literal runat="server" id="txtVoteCount" />)
<br />
Minder Score: <asp:Literal runat="server" id="txtMinderScore" />
and on code behind place this values.
If you see this sample http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Rating/Rating.aspx
and get the source code from the SDK, this is the way is doing it.
<asp:Panel id="container" CssClass="container" runat="server" style="width:850px">
<asp:Panel runat="server" id="header" cssClass="header" >
<div class="msg"> </div>
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="close" OnClientClick="clearDataKey()" />
</asp:Panel>
<div runat="server" id="whatup">
<asp:Panel ID="Panel2" runat="server" >
<uc1:messageBox ID="InfoBox" runat="server" />
</asp:Panel>
</div>
<asp:updatepanel ID="upcsconfirmation" runat="server">
<ContentTemplate>
<cc1:ModalPopupExtender ID="popupCS" runat="server" BehaviorID="popupCS" TargetControlID="btnTargetCS"
PopupControlID="pnlPopupCS" BackgroundCssClass="modalBackground"/>
<asp:Button ID="btnTargetCS" runat="server" Text="Button" cssClass="hide" />
<cc1:DragPanelExtender ID="DragPanelExtenderCS" TargetControlID="pnlPopupCS" runat="server"></cc1:DragPanelExtender>
<asp:Panel ID="pnlPopupCS" runat="server" SkinID="modal"></asp:Panel>
</ContentTemplate>
</asp:updatepanel>
<div class="body" >
<div class="contentarea" style="height:200px;">
<asp:TextBox ID="datakeyholder" runat="server" style="display:none" Enabled="False" />
<asp:ObjectDataSource ID="odsCopyCustRequirements" runat="server" InsertMethod="InsertSearchRequirement"
TypeName="SearchRequirementsDataObject"
oninserting="Requirements_Inserting" >
</asp:ObjectDataSource>
<div style="height: 100%; width: 100%">
<div id="Div1" style="float: left; width: 45%; padding-left:10px">
<div class="column130">
<asp:Label ID="lblSearch1" runat="server" Text="FAST Region:"></asp:Label></div>
<asp:UpdatePanel ID="UpnlCust" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="column130">
<asp:DropDownList ID="ddSearch1" AutoPostBack="true" DataTextField="Name"
OnSelectedIndexChanged="ddSearch_SelectedIndexChanged" DataValueField="id"
runat="server" Width="150px">
</asp:DropDownList>
</div>
<div class="column130">
<asp:Label ID="lblSearch2" runat="server" Text="Owning Office:"></asp:Label></div>
<div class="column130">
<asp:DropDownList ID="ddSearch2" DataTextField="Name" DataValueField="fastid"
runat="server" Width="150px">
</asp:DropDownList>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddSearch1" />
</Triggers>
</asp:UpdatePanel>
<div class="column">
</div>
</div>
</div>
</div>
<p></p>
The upper update panel (upcsconfirmation) containing modal popup extender should have UpdateMode = "Conditional" - otherwise, asynchronous post-back from bottom update panel will also update its content restoring the modal popup to hidden state.
Yet another way to solve your issue is to use Show method of popup extender on server side when the bottom update panel posts back (for example, you can put the call popupCS.Show() in ddSearch_SelectedIndexChanged to keep the modal popup open).
I have a button on which I am calling a modal pop up extender which is showing a panel. Below is the code:
<asp:Button ID="btnOne" runat="server" Text="View "
onclick=" btnOne_Click" />
<asp:Panel ID="test" CssClass="ModalWindow" Width="100%" ScrollBars="Both" runat="server">
<table id="tblgv" width="100%">
<tr>
<td>
<asp:GridView ID="gvTwo" runat="server">
</asp:GridView>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnPopUpCancel" runat="server" Text="Close" />
</td>
</tr>
</table>
</asp:Panel>
<asp:ModalPopupExtender ID="ModalPopupExtender1" OkControlID="btnPopUpCancel"
TargetControlID=" btnOne " PopupControlID="test" runat="server">
</asp:ModalPopupExtender>
In the panel, I have a gridview. I want that when I click the button gridview will be loaded. But it is not happening, when I clicked on the button it is not going server side.
help me how to resolve it.
Your problem is that the ModalPopup is showing Client side.
If you what to do stuff (bind the gridview) you need do trigger a postback to the server.
add a dummy target for the ModalPopup
< asp:Button runat="server" ID="HiddenTargetControlForModalPopup" style="display:none" />
set TargetControlID="HiddenTargetControlForModalPopup"
call ModalPopupExtender1.show() inside the btnOne_Click event.
btnOne will now trigger a serverside event. You should also put the Gridview inside a update panel and set btnOne at as asyncpostback trigger.
Hope this will help.
You Can Use Asynchronous PostBack Trigger Or PostBackTrigger as per your need. Id want this Grid View In update panel you need to use Asynchronous PostBack Trigger.
and if you want that page to be reload at button click you need to have post back trigger and make sure that control button to be inside that update panel.
Here is an Example
<asp:UpdatePanel ID="UPDTree" runat="server">
<ContentTemplate>
<asp:LinkButton ID="lnkfaketree" runat="server"></asp:LinkButton>
<asp:ModalPopupExtender ID="mpeTree" runat="server" BackgroundCssClass="modalBackground recharge" CancelControlID="btntreeclose" PopupControlID="paneltree" TargetControlID="lnkfaketree"></asp:ModalPopupExtender>
<asp:Panel ID="paneltree" runat="server" Style="display: none">
<div class="btn-group pull-right">
</div>
<div class="box box-primary">
<div class="box-header with-border" style="padding: 3px; background-color: #14181a; font-weight: bolder">
<h3 class="box-title" style="color: white">Tree View</h3>
<div class="btn-group pull-right">
<asp:LinkButton ID="btntreeclose" runat="server" CssClass="fa fa-close" OnClick="btntreeclose_Click"></asp:LinkButton>
</div>
</div>
<div class="form-horizontal">
<div class="box-body">
<div id="chart_div" style="width: 1000px; height: 500px; overflow: auto">
</div>
<asp:Button id="BtnNext" runat="server" OnClick="selectHandler()" />
<asp:Button id="btn_Submit" runat="server" OnClick="selectHandler2()" />
</div>
</div>
</div>
</asp:Panel>
</ContentTemplate><Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnNext" EventName="Click" />
<asp:PostBackTrigger ControlID="btn_Submit" />
</Triggers>
</asp:UpdatePanel>