| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 918 人关注过本帖
标题:Gradeview 自定义控件语言转换问题
只看楼主 加入收藏
liangshijun
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-6
收藏
 问题点数:0 回复次数:3 
Gradeview 自定义控件语言转换问题
前台代码如下:
<asp:GridView ID="testDatagrid" runat="server" AutoGenerateColumns="False" OnRowDataBound="testDatagrid_RowDataBound" Width="294px" Height="134px">
            <Columns>
                <asp:CheckBoxField HeaderText="可选" />
   
                <asp:BoundField DataField="ToolName" HeaderText="text" />
                <asp:TemplateField HeaderText="数量"></asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="数据的更新" />
 
 
后台代码实现如下:
  #region GridView绑定动态生成的控件
    protected void testDatagrid_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowIndex > -1)
        {

            CheckBox check = new CheckBox();
            check.ID = e.Row.RowIndex.ToString();
            check.AutoPostBack = true;
            check.CheckedChanged += new EventHandler(check_CheckedChanged);
            e.Row.Cells[0].Controls.Add(check);

            TextBox text = new TextBox();
            text.Width = 15;
            text.ID = "txt" + e.Row.RowIndex.ToString();
            text.Enabled = false;
            e.Row.Cells[2].Controls.Add(text);
            HiddenField hidden = new HiddenField();
            hidden.Value = da.Tables[0].Rows[e.Row.RowIndex][0].ToString();
            hidden.ID = "Hidd" + e.Row.RowIndex.ToString();
            e.Row.Cells[2].Controls.Add(hidden);
        }

    }
    #endregion
    #region 处理checkbox所触发的事件
    void check_CheckedChanged(object sender, EventArgs e)
    {
        int i = Convert.ToInt32(((CheckBox)sender).ID);
        TextBox box = this.testDatagrid.Rows[i].Cells[2].FindControl("txt" + i.ToString()) as TextBox;
        box.Enabled = true;
    }
    #endregion
    #region 将客户所选的数据插入数据库
    protected void Button1_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < this.testDatagrid.Rows.Count; i++)
        {
            CheckBox chB = this.testDatagrid.Rows[i].Cells[0].FindControl(i.ToString()) as CheckBox;
            TextBox txB = this.testDatagrid.Rows[i].Cells[2].FindControl("txt" + i.ToString()) as TextBox;
            HiddenField hid = this.testDatagrid.Rows[i].Cells[2].FindControl("Hidd" + i.ToString()) as HiddenField;
            int ii = -1;
            if (chB.Checked)
            {
                if (txB.Text != null)
                {
                    try
                    {
                            //引用 DataBase.dll  
                        ii = new ZHXKDatabase(connStr).RunSQLCommandReturnInt("insert into Relation (ToolsID,TagID,[Desc]) values (" + hid.Value + "," + 12 + "," + int.Parse(txB.Text.Trim()) + ")");
                    }
                    catch (Exception exc)
                    {
                        Response.Write(exc.Message);

                    }
                }
                if (ii == 1)
                {
                    Response.Write("OK!");
                }
            }
        }
    }
    #endregion
那位大虾能帮忙将两个处理函数转换成用VB编写的函数!!!!!!!!!!
搜索更多相关主题的帖子: Gradeview 控件 语言 定义 前台 
2008-06-06 22:55
liangshijun
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-6
收藏
得分:0 
解决了,呵呵
2008-06-15 17:20
ICESJ
Rank: 1
来 自:上海
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-6-9
收藏
得分:0 
没搞懂你说的什么意思?呵呵
2008-06-15 22:02
ICESJ
Rank: 1
来 自:上海
等 级:新手上路
帖 子:8
专家分:0
注 册:2008-6-9
收藏
得分:0 
没搞懂你说的什么意思?呵呵
2008-06-15 22:02
快速回复:Gradeview 自定义控件语言转换问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.063217 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved