Microsoft Mediaroom按钮单击事件

时间:2012-08-18 12:51:47

标签: asp.net

我怀疑TVButton对mediaroom的控制。有mediaroom演示框架附带的事件和动作。我可以在我的代码中为tvbutton调用我自己的事件处理程序。 onButtonClick =“btnlogin_ButtonClick”无效。如果我为void btnlogin_ButtonClick编写我的自定义代码(对象发送者,EventArgs e){}

onButtonClick没有开火!  mediaroom的样本代码!

 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="SubmitAction_01_Designer.aspx.cs"
    Inherits="TVPage_TVPage_Submit" %>

<%@ Register Assembly="TVControls" Namespace="Microsoft.TV.TVControls" TagPrefix="mrml" %>
<%@ Register Assembly="TVControls" Namespace="Microsoft.TV.TVControls.Actions" TagPrefix="mrml" %>
<form id="form1" runat="server">
<mrml:TVPage ID="TVPage1" runat="server" Style="position: absolute;">
    <mrml:TVPanel ID="TVPanel2" runat="server" Background="image(file:/BG_Masthead.png)"
        Style="z-index: 102; left: 0px; width: 632px; position: absolute; top: 0px; height: 99px">
        <mrml:TVImage ID="TVImage2" runat="server" Style="left: 16px; width: 260px; position: absolute;
            top: 23px; height: 80px" Url="file:///Brand_Service_Menu.png">
        </mrml:TVImage>
        <mrml:TVLabel ID="TVLabel3" runat="server" Background="@Transparent" Foreground="@TextHeader"
            HorizontalAlign="right" VerticalAlign="bottom" Padding="rect(0,0,0,0)" Style="left: 265px;
            width: 331px; position: absolute; top: 13px; height: 69px" Text="SubmitAction - Designer"
            Wrap="false">
        </mrml:TVLabel>
    </mrml:TVPanel>
    <mrml:TVText ID="TVText1" runat="server" Style="position: absolute; top: 137px; left: 347px;"
        MaxChars="100">
    </mrml:TVText>
    <mrml:TVButton ID="TVButton1" runat="server" Style="position: absolute; top: 197px;
        left: 352px;" OnClick="SubmitAction0" Text="Click To submit">
    </mrml:TVButton>
    <mrml:TVActions ID="TVActions1" runat="server" Actions-Capacity="4">
        <mrml:SubmitAction Gadgets="TVText1" Method="Get" Name="SubmitAction0" Target=""
            Url="SubmitAction_02_Designer.aspx" X="5" Y="5" />
    </mrml:TVActions>
    <mrml:TVLabel ID="TVLabel4" runat="server" Style="position: absolute; top: 137px;
        left: 67px; height: 158px; width: 246px;" Text="Enter some text in TVText and click on TVButton to submit the TVpage. When the TVPage is submitted,
the control goes to the next page where you can see the text entered in the previous page.">
    </mrml:TVLabel>
</mrml:TVPage>
</form>

所以在这里我们只能给OnClick =“SubmitAction0”。以上示例是源视图

示例背后的代码:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.TV.TVControls.Actions;
using Microsoft.TV.TVControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        /*        <mrml:MoveAction Height="40" Left="270" Name="MoveAction0" Target="txtMove" 
            Top="138" Width="100" X="117" Y="117" />
        <mrml:ShowAction Name="ShowAction0" Targets="lblShow" X="89" Y="89" />
        <mrml:SetAction Name="SetAction0" PropertyName="value" PropertyValue="Set" 
            Target="txtSet" X="61" Y="61" />
        <mrml:HideAction Name="HideAction0" Targets="lblHide" X="5" Y="5" />
        <mrml:KeyAction Key="1" Name="KeyAction0" Target="txtKey" X="33" Y="33" />
        <mrml:FocusAction Name="FocusAction0" Target="btnFocus" X="229" Y="100" />*/

        MoveAction objMove = new MoveAction("MoveAction0", "txtMove", 270, 138, 100, 40);
        TVActions1.Actions.Add(objMove);
        ShowAction objShow = new ShowAction("ShowAction0", "lblShow");
        TVActions1.Actions.Add(objShow);
        SetAction objSet = new SetAction("SetAction0", "txtSet", "value", "Set");
        TVActions1.Actions.Add(objSet);
        HideAction objHide = new HideAction("HideAction0", "lblHide");
        TVActions1.Actions.Add(objHide);
        KeyAction objKey = new KeyAction("KeyAction0", "txtKey", "1");
        TVActions1.Actions.Add(objKey);
        FocusAction objFocus = new FocusAction("FocusAction0", "btnFocus");
        TVActions1.Actions.Add(objFocus);

        TVButton1.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("ShowAction0");
        TVButton2.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("HideAction0");
        TVButton3.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("SetAction0");
        TVButton4.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("KeyAction0");
        TVButton5.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("FocusAction0");
        TVButton6.OnClick = new Microsoft.TV.TVControls.Events.ClickEvent("MoveAction0");

        //Following lines are for displaying the file name
        /*<mrml:TVLabel ID="lblFileName" runat="server" 
                style="position: absolute; top: 69px; left: 9px; width: 241px;" Text="TVLabel">
            </mrml:TVLabel>*/
        TVLabel lblFileName = new TVLabel();
        lblFileName.ID = "lblFileName";
        lblFileName.Left = 40;
        lblFileName.Top = 70;
        lblFileName.Width = 500;
        lblFileName.Text = HttpContext.Current.Request.FilePath;
        lblFileName.IsVisible = true;
        TVPage1.Controls.Add(lblFileName);
    }
}

2 个答案:

答案 0 :(得分:0)

您可以尝试使用OnClick而不是OnButtonClick

OnClick="btnlogin_ButtonClick"

答案 1 :(得分:0)

我不知道你是否还需要一些关于此的信息,但是 在您的特定情况下通过按钮调用页面单击Href似乎更好地工作,如此示例

<mrml:TVButton ID="TVButton7" runat="server" Background="argb(211,0,79,194)" 
         Href="~/Menu%20principal/Menu.aspx" IsVisible="False" 
         style="position: absolute; top: 433px; left: 224px;" Text="Back to Menu">
</mrml:TVButton>    

然后使用页面的Page_Load事件来执行您想要的操作。