开发者

how to get checkedlistbox items selected when clicking a row in DataGridView

my DataGridView

id       FN      LastN  City    Deg   Skillset        Gender

10       ma      Alex   Trichy  BE    .net,html,sql   Male      
11       giri    mani   Madu    BE    .net, java      Male     

When I click id 10 I want my checkedlistbox items(.net,htm开发者_如何学Gol,sql) being checked. c# plz..


you can do it by using javascript put a click event on every row of datagrid view

        dataGridView1.RowDataBound += new GridViewRowEventHandler(dataGridView1_RowDataBound);

    void dataGridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.DataItem != null)
        {
            var r = Convert.ToInt32(ViewData["RequesterCode"]);
            if (e.Row.DataItem is AC.CCBS.ServiceFactory.AndcWorkFlow.RequestView)
            {
                var s = e.Row.DataItem as AC.CCBS.ServiceFactory.AndcWorkFlow.RequestView;
                var r1 = s.RequestCode;
                e.Row.Attributes.Add("onclick","DoSome(this);");
            }
        }
    }

<script DoSome>
DoSome=function(sender){
 //do something here
}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜