asp.net 控件 (.ascx) 与 dijit?
我试图让一个 asp.net 下拉列表控件成为一个 dijit 组合框,但它不起作用。
我已经尝试过:
<asp:DropDownList ID="ddlUserID" dojoType="dijit.form.ComboBox" runat="server"
DataTextField="FullNameAndUserName"
CssClass="stdtext" DataValueField="UserID" AppendDataBoundItems="True"
AutoPostBack="True"
meta:resourcekey="ddlUserIDResource1" EnableTheming="False">
<asp:ListItem Text="(All Users)" Value="0" meta:resourcekey="ListItemResource1" />
</asp:DropDownList>
<script type="text/javascript" src="../scripts/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require('dijit.form.ComboBox');
</script>
dojo.js 的路径是相对于 ascx 控件的包含父页面的,并且根据 firebug 可以正常加载。
渲染的html是这样的:
<select id="invoiceReport1_ddlUserID" class="stdtext" dojotype="dijit.form.ComboBox" onchange="javascript:setTimeout('__doPostBack(\'invoiceReport1$ddlUserID\',\'\')', 0)" name="invoiceReport1$ddlUserID">
</select>
<script src="../scripts/dojo/dojo.js" type="text/javascript">
</script>
<script type="text/javascript">
</script>
<script type="text/javascript">
查看 http://docs.dojocampus.org/dijit 中的示例/表单/组合框 我不明白为什么生成的选择标签不是组合框。
我也尝试过这个:
HtmlGenericControl ctrl1 = new HtmlGenericControl("Script");
ctrl1.Attributes.Add("Type", "Text/Javascript");
ctrl1.Attributes.Add("src", "../Scripts/dojo/dojo.js");
this.Page.Header.Controls.Add(ctrl1);
HtmlGenericControl ctrl2 = new HtmlGenericControl("Script");
ctrl2.Attributes.Add("Type", "Text/Javascript");
ctrl2.InnerText = "dojo.require('dijit.form.ComboBox');";
this.Page.Header.Controls.Add(ctrl2);
有什么建议吗?
i've tried to get an asp.net dropdownlist control to become a dijit combobox but it's not working.
i've tried this:
<asp:DropDownList ID="ddlUserID" dojoType="dijit.form.ComboBox" runat="server"
DataTextField="FullNameAndUserName"
CssClass="stdtext" DataValueField="UserID" AppendDataBoundItems="True"
AutoPostBack="True"
meta:resourcekey="ddlUserIDResource1" EnableTheming="False">
<asp:ListItem Text="(All Users)" Value="0" meta:resourcekey="ListItemResource1" />
</asp:DropDownList>
<script type="text/javascript" src="../scripts/dojo/dojo.js"></script>
<script type="text/javascript">
dojo.require('dijit.form.ComboBox');
</script>
the path to dojo.js is relative to the containing parent page of the ascx control and loads fine according to firebug.
the rendered html is this:
<select id="invoiceReport1_ddlUserID" class="stdtext" dojotype="dijit.form.ComboBox" onchange="javascript:setTimeout('__doPostBack(\'invoiceReport1$ddlUserID\',\'\')', 0)" name="invoiceReport1$ddlUserID">
</select>
<script src="../scripts/dojo/dojo.js" type="text/javascript">
</script>
<script type="text/javascript">
</script>
<script type="text/javascript">
looking at the examples from http://docs.dojocampus.org/dijit/form/ComboBox
i cant see why the resulting select tag is not a combobox.
i've also tried this:
HtmlGenericControl ctrl1 = new HtmlGenericControl("Script");
ctrl1.Attributes.Add("Type", "Text/Javascript");
ctrl1.Attributes.Add("src", "../Scripts/dojo/dojo.js");
this.Page.Header.Controls.Add(ctrl1);
HtmlGenericControl ctrl2 = new HtmlGenericControl("Script");
ctrl2.Attributes.Add("Type", "Text/Javascript");
ctrl2.InnerText = "dojo.require('dijit.form.ComboBox');";
this.Page.Header.Controls.Add(ctrl2);
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案最终是这样的:
您必须在样式表中或直接引用 dijit.css。
the solution ended up being this:
you must refer to dijit.css either in your stylesheet or directly.