-1
 // Assign Context-Menu to Control
    $(function () {
        var txt1 = "#" + "<%= **myCal**.ClientID %>";

        // Attach Context-Menu to Control
        $(txt1).contextMenu(ctxtMenu, { theme: 'vista' });
    });

背后的代码

            TextBox lbl = new TextBox ();
            lbl.BorderColor = System.Drawing.Color.Black;
            lbl.BorderStyle = BorderStyle.Double;
            lbl.BackColor = System.Drawing.Color.BlanchedAlmond;
            lbl.Text = eventname + "<br/>" + dt + "" + dt1;
            e.Cell.Controls.Add(lbl);

我想使用动态创建的 asp.net TextBox 代替 myCal

我该怎么办?请帮忙

4

1 回答 1

1

您可以为此控件定义一个 CSS 类:

lbl.CssClass = "menu";

然后使用类选择器:

$(function () {
    // Attach Context-Menu to Control
    $('.menu').contextMenu(ctxtMenu, { theme: 'vista' });
});
于 2012-09-23T16:59:08.233 回答