gpt4 book ai didi

c# - 如何使用 RegisterStartupScript 传递查询字符串?

转载 作者:行者123 更新时间:2023-11-30 17:20:44 24 4
gpt4 key购买 nike

我的代码后面有这个:

ScriptManager.RegisterStartupScript(this, typeof(string), Guid.NewGuid().ToString().Replace("-", ""), "window.setTimeout(\" $('#" + calendar.ID + "').fullCalendar({header: {left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay'},aspectRatio: 2.2,editable: true,events: " + sJSON + ", eventClick: function(event) { OpenModal('Novo Compromisso','100%','500px','/agenda/form.aspx?compromissoid=event.id');}});\",100);", true);

它获取一些数据并加载日历的事件属性。在 eventClick 上,我想访问 event.id 以打开模式窗口并编辑事件。但是查询字符串按字面意思设置为“event.id”。

我检查了 event.id 是否有值。这是因为它出现在 alert() 函数中,如下所示。

ScriptManager.RegisterStartupScript(this, typeof(string), Guid.NewGuid().ToString().Replace("-", ""), "window.setTimeout(\" $('#" + calendar.ID + "').fullCalendar({header: {left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay'},aspectRatio: 2.2,editable: true,events: " + sJSON + ", eventClick: function(event) { alert(event.id); OpenModal('Novo Compromisso','100%','500px','/agenda/form.aspx?compromissoid=event.id');}});\",100);", true);

那么,如何使用 event.id 值作为我的查询字符串?

最佳答案

在您的 OpenModal 调用中,将您的 url 从这个 '/agenda/form.aspx?compromissoid=event.id' 更改为:'/agenda/form.aspx?compromissoid=' + event.id

    ScriptManager.RegisterStartupScript(this, typeof(string), Guid.NewGuid().ToString().Replace("-", ""), "window.setTimeout(\" $('#" + calendar.ID + "').fullCalendar({header: {left: 'prev,next today',center: 'title',right: 'month,agendaWeek,agendaDay'},aspectRatio: 2.2,editable: true,events: " + sJSON + ", eventClick: function(event) { alert(event.id); OpenModal('Novo Compromisso','100%','500px','/agenda/form.aspx?compromissoid=' + event.id);}});\",100);", true);

关于c# - 如何使用 RegisterStartupScript 传递查询字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25185168/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com