文本框的Text属性未设置

时间:2014-09-29 10:34:57

标签: c# asp.net

当我单击ASP.NET列表视图中的链接按钮时,会激活包含文本框(lbCBody)的模式弹出窗口。

textbox属性没有设置,即使我在lbCBody.Text设置断点时也设置了这个。

这里有什么想法?

protected void lvCalendar_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        ScriptManager.RegisterStartupScript(this, typeof(Page), "ajaxScript", "showCalendar();", true);

        //cast the postback causing control respectively, LinkButton/Button:
        System.Web.UI.WebControls.LinkButton btn = e.CommandSource as System.Web.UI.WebControls.LinkButton;

        //get the ListViewItem:
        ListViewItem item = btn.NamingContainer as ListViewItem;

        HiddenField hfViewCalID = item.FindControl("hfViewCalTodayID") as HiddenField;

        int sID = Convert.ToInt32(hfViewCalID.Value);

        UserCalendar selC = context.UserCalendars.FirstOrDefault(a => a.ID == sID);

        //lbCHeading.Text = selC.EventName;
        lbCBody.Text = selC.Description;
    }

模态弹出

<div id="viewCalendarModel" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
    <asp:HiddenField ID="hfViewCal" ClientIDMode="Static" runat="server" />
    <div class="modal-header">
        <h3>
            <asp:Label ID="lbCHeading" runat="server"></asp:Label></h3>
    </div>
    <div class="modal-body">
        <div class="control-group">
            <div class="controls controls-row">
                <asp:TextBox ID="lbCBody" runat="server"></asp:TextBox>
            </div>
        </div>
    </div>
    <%--<div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    </div>--%>
</div>

1 个答案:

答案 0 :(得分:0)

这是因为日历位于更新面板内,但模式弹出窗口位于更新面板之外。