动态填充复选框 [英] dynamically populate check boxes

查看:96
本文介绍了动态填充复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

最近,我被要求将borland 2006 c ++重写为c#.我已经绘制了复选框,并且是55个左右的复选框.检查框应链接到11g数据库,并且它们从远程服务器上的数据库中获取其值(名称,标签,选中或未选中).有谁知道我该怎么做.我正在连接到oracle数据库,并且已经准备就绪:

Hello All

I recently been tasked with rewriting my borland 2006 c++ into c#. I have drawn the checkboxes and is 55 or so checkboxes. The checboxes ought to be linked to the 11g database and they get their values (names, labels, checked or unchecked) from the database on a remote server. DOes anyone have any idea how i could do this. I am connecting to an oracle database and i have allready:

using Oracle.DataAccess.Client;
string oradb = "Data Source=";
            oradb = oradb + Login.db + ";";
            oradb = oradb + "User Id=" + Login.user;
            oradb = oradb + ";Password=" + Login.pass + ";";
            OracleConnection conn = new OracleConnection(oradb);
            conn.Open();
            
string sql = "SELECT PROGRAM_FIELD,DBFIELD, ACTIVE, S.PROGRAM_LABEL FROM GENDBA.SUPTALLYACTIVITIESCONFIG S where active = 'Y' and gcos_schema = '" + frmSchema.schema +"'";

            OracleCommand cmd = new OracleCommand(sql, conn);
            cmd.CommandType = CommandType.Text;
            OracleDataReader dr = cmd.ExecuteReader();
            dr.Read();



在博士之后,我有点卡住了.感谢您能提供的任何帮助.

ps:出于兴趣考虑,该模式具有4个不同的模式,并且对于同一复选框,每个模式具有不同的值.总共有189行,结合了所有4个模式.

预先谢谢您



after the dr I''m sort of stuck. I appreciate any help you could provide.

ps: as a matter of interest the schema has 4 different schemas and each schema has different values for the same checkbox. in total we have 189 rows combining all 4 schemas.

Thank you in advance

推荐答案

最好使用XML动态填充控件
甲骨文如何做到呢?
喜欢
Its better to use XML for populating controls dynamically
How ever with Oracle you can do it
like
chkbox1.checked = dr["name"].value


这是否意味着我必须对所有复选框执行此操作?
does this mean that i will have to do this for all checkboxes?


这里是示例,我要填充一个根据Gridview的选定行的第9个单元格值创建的复选框值,所以我做到了===>
Here''s the sample,i want to populate a checkbox value according to Gridview''s selected row''s 9th cell value so i did this ===>
string valuechk = dataGridView1.CurrentRow.Cells[9].Value.ToString ();
              bool chkvalue = Convert.ToBoolean(valuechk);

              if(chkvalue ==false)
                   assignchk.Checked = false;//check box value assigning
               else
                   assignchk.Checked = true;


现在按照您的要求制作代码此处


Now make your code as per your requirementHeres


这篇关于动态填充复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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