列表框添加 [英] List Box Adding

查看:83
本文介绍了列表框添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在该项目中我有一个列表框,该列表框已由'',''分隔,例如(它是软件,硬件,银行,帐户),这些都来自网格视图检查项目,当我单击所需的项目时,我有一个复选框添加自己的项目,这些项目我也要显示,例如'',''(不在下一行中)我只想添加项目,仅用'',''
分隔一行
我写了为gridview复选框编写代码,并在列表框中添加了以,"分隔的


I have one list box in that item having separated by '','' like (It software,Hardware,Banking,accounts) these are all coming from grid view check items and I have one check box when i click on that I want add own items that items also I want to display like '','' (not in next line) I want add items only single line separated by '',''

I wrote coding for gridview check box adding in list box with separated by '',''


protected void chkcheckquery_CheckedChanged(object sender, EventArgs e)
    {
        
       
        try
        {
            sb = new StringBuilder();
            foreach (GridViewRow gr in gvqueriescheck.Rows)
            {
                if (((CheckBox)gr.FindControl("chkcheckquery")).Checked == true)
                {
                    sb.Append(gr.Cells[1].Text + ",");

                }
            }
            ListBox1.Items.Clear();
            ListBox1.Items.Add(sb.ToString())
        }
        catch (Exception ex)
        {
            lblmessage.Text = ex.Message;
        }

    }



在gridview下面,我有一个文本框,我将在文本框中输入要在列表框中添加的任何内容,并使用'',''


[已编辑]代码包装在"pre"标记中[/已编辑]



and below gridview I have text box I will enter anything in textbox I want to add in listbox with '',''


Code is Wrapped in "pre" tag[/Edited]

推荐答案

目前尚不清楚. > 您可以用相同的方式添加它,例如
It''s not quite clear.
You can add it same way, like
ListBox1.Items.Add(textBox1.Text):



还是我错过了什么?



Or am I missing something?


这篇关于列表框添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆