使用SqlWhereBuilder ASP.. NET服务器控件从数据库填充值
Using the SqlWhereBuilder ASP.NET Server Control to populate values from database
我有麻烦让SqlWhereBuilder.js填充我的下拉与值从我的数据库。我已经指定了一个valueentry配置文件和相应的.ascx和. asx .cs文件。我检查了. asx .cs文件中的查询,它返回了我需要的值。但是我无法在我的网站过滤器功能中填充这些值的下拉菜单。我在这里错过了什么…我使用这个控件对吗?
我的字段文件和操作符列表文件从xml正确填充。但是只有数据库中的值不填充。
我的。aspx文件:
<asp:Panel ID="panelContentCS" Style="overflow: hidden;" Width="650px" runat="server">
<div id="LayerCS" style="padding-left: 20px; padding-bottom: 10px; padding-top: 10px;
padding-right: 10px;">
<cc1:SqlWhereBuilder ID="swb1" runat="server" ClientCodeLocation="js/SqlWhereBuilder.js"
FieldsFile="Configuration/fields.config" OperatorListsFile="Configuration/operatorLists.config"
ValueEntryFile="Configuration/valueEntryDivs.config" NoConditionsText="Please Specify conditions"
ButtonStyle="font-size: 10pt; background:whitesmoke;border:2px; border-style:solidline;"
MainStyle="background-color:gainsboro;" ConditionCellStyle="border:1px solid black; padding:2px; background-color:#eeeeee"
EditButtonText="Edit" DeleteButtonText="Delete" AddButtonText=" Add " EditButtonsHiliteColor="Gray"
EditButtonsStyle="font-family: 'Arial'; font-size: 10pt; cursor:pointer;" ConditionDisplayStyle="font-family: 'Tahoma': font-size: 10pt; padding 2px;">
</cc1:SqlWhereBuilder>
</div>
</asp:Panel>
我valueEntryDivs.config :
<valueEntry id="vCodeR" userControl="SQLBuilder/CodeR.ascx" />
<valueEntry id="vCodeQ" userControl="SQLBuilder/CodeQ.ascx" />
<valueEntry id="vCodeT" userControl="SQLBuilder/CodeT.ascx" />
我CodeT.ascx :
<%@ Control Language="C#" AutoEventWireup="false" CodeFile="CodeT.ascx.cs" Inherits="CodeT" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<asp:DropDownList id="ddCodeT" runat="server" DataValueField="CodeT" DataTextField="CodeT"></asp:DropDownList>
我CodeT.ascx.cs :
public partial class CodeT : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
int count = 0;
int j = 0;
DbDataReader rdr = null;
DbProviderFactory provider = Framework.ConnectionClass.GetDbFactory();
DbConnection conn = null;
conn = Framework.ConnectionClass.GetConnection("Code"); conn.Open();
DbCommand cmd = provider.CreateCommand();
cmd.CommandText = "SELECT [VALUE] AS CodeT FROM tb_Searchcache WHERE LabelName = 'CodeT'";
cmd.Connection = conn;
if (!this.IsPostBack)
{
try
{
rdr = Framework.DBClass.GetReader(ref cmd);
ddCodeT.DataSource = rdr;
ddCodeT.DataBind();
count = ddCodeT.Items.Count;
while (j < count)
{
ddCodeT.Items[j].Value = "'" + ddCodeT.Items[j].Value + "'";
j = j + 1;
}
}
finally
{
if ((rdr != null))
{
rdr.Close();
}
cmd.Dispose();
if (conn.State != ConnectionState.Closed)
conn.Close();
}
}
}
}
在浪费了相当多的时间之后,我才意识到我需要设置AutoEventWireup为"true"。回发从未触发任何东西!
相关文章:
- PHP下拉列表由要使用javascript的数据库填充
- 使用javascript服务填充数据库中的下拉值
- 从数据库预填充模式(非引导)
- 从数据库填充JQueryUI
- 从另一个选择框并使用数据库连接填充选择框
- 在选择下拉选项时,从mysql数据库填充HTML表单字段
- 从数据库填充的下拉菜单中更新输入字段
- 使用 JavaScript 从数据库填充网格视图
- 离子收集重复 - 未命中由websql数据库填充
- 如何根据另一个组合框的选定项目从数据库填充组合框中的项目
- 优化WebSQL本地数据库填充
- 从数据库填充谷歌地图信息窗口
- 如何使用Codeigniter从数据库填充下拉列表
- 输入值并与数据库填充的值进行比较后的报警框
- 从SQL数据库填充Facebook提要对话框
- 通过struts2操作类(使用jtable)从数据库填充下拉列表
- 在初始加载时根据下拉列表中的值设置文本框(由数据库填充)
- 使用SqlWhereBuilder ASP.. NET服务器控件从数据库填充值
- 使用 php 从数据库填充初始化 jquery 数组时,Jquery 标签编辑器不起作用
- 用json和php从数据库填充listview