asp.net 中的 Facebox - 更新数据库,使用 Facebox 中预设的文本框值

发布于 2024-08-19 13:00:16 字数 1682 浏览 10 评论 0原文

我最近一直在使用Facebox,它似乎与asp.net 配合得不太好。在这个论坛的帮助下,我解决了从文本框中检索值以及从面部框内的按钮捕获事件的问题。

现在,我偶然发现了另一个奇怪的问题。如果我用现有值填充面部框内的文本框,则在打开面部框之前,打开面部框,更改一些值,点击从文本框中抓取新值的按钮,抓取的值是文本框的值在打开脸箱之前就已经填充了。

这是我的 .aspx 页面中的代码:

<a href="#facebox" rel="facebox">open facebox</a>
    <div id="facebox" style="display: none;">
        <p>
            1:&nbsp;<span><asp:TextBox ID="txt_reason1" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <p>
            2:&nbsp;<span><asp:TextBox ID="txt_reason2" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <p>
            3:&nbsp;<span><asp:TextBox ID="txt_reason3" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <asp:Button ID="Button2" runat="server" Text="Gem" OnClick="Button2_Click" />
    </div>

然后在我的代码隐藏中,我在 Facebox 中设置文本框(当页面加载时),如下所示:(_goal 是一个业务对象)

    txt_reason1.Text = _goal.GoalReason1;
    txt_reason2.Text = _goal.GoalReason2;
    txt_reason3.Text = _goal.GoalReason3;

然后我更改 .aspx 中的一些值并点击在事件处理程序中使用此代码的按钮:

    _goal.GoalReason1 = txt_reason1.Text;
    _goal.GoalReason2 = txt_reason2.Text;
    _goal.GoalReason3 = txt_reason3.Text;
    bool res = GoalManager.UpdateGoal(_goal);

它几乎只是使用文本框值设置一些对象属性,并用它更新数据库。但是,文本框值没有更改,我使用调试器检查了它。我的猜测是,facebox 以某种方式拒绝更改文本框。我不知道,所以我希望这里有人了解更多关于facebox的信息,甚至可能解决这个问题......

I've been using Facebox lately, and it seems like it doesn't play well with asp.net. With the help from this forum, i solved the problems with retrieving values from textboxes, as well as capturing the event from a button inside the facebox.

Now, I have stumbled onto another strange problem. If i populate the textboxes inside the facebox with existing values, before the facebox is opened, open the facebox, change some of the values, hit a button that graps the new values from the textboxes, the values that are grapped are the ones the textboxes were populated with before the facebox was opened.

This is the code in my .aspx page:

<a href="#facebox" rel="facebox">open facebox</a>
    <div id="facebox" style="display: none;">
        <p>
            1: <span><asp:TextBox ID="txt_reason1" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <p>
            2: <span><asp:TextBox ID="txt_reason2" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <p>
            3: <span><asp:TextBox ID="txt_reason3" runat="server" Width="200" TextMode="MultiLine"
                Rows="2"></asp:TextBox></span></p>
        <asp:Button ID="Button2" runat="server" Text="Gem" OnClick="Button2_Click" />
    </div>

Then in my codebehind, I set the textboxes (when the page loads) in the facebox like this: (_goal is a business object)

    txt_reason1.Text = _goal.GoalReason1;
    txt_reason2.Text = _goal.GoalReason2;
    txt_reason3.Text = _goal.GoalReason3;

I then change some values in the .aspx and hit the button with this code in the eventhandler:

    _goal.GoalReason1 = txt_reason1.Text;
    _goal.GoalReason2 = txt_reason2.Text;
    _goal.GoalReason3 = txt_reason3.Text;
    bool res = GoalManager.UpdateGoal(_goal);

which pretty much just sets some object properties with the textbox values, and updates the database with it. But, the textbox values are not changed, and I checked it using the debugger. My guess is that facebox is somehow denying the textboxes to be changed. I don't know, so I was hoping that someone in here knows more about facebox, and maybe even solved this problem...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尤怨 2024-08-26 13:00:16

在这个线程中没有找到解决方案。关闭....

Did not find a solution in this thread. Closed....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文