division - how to populate comma delimited string to checkboxlist in gridview -


protected void mygrid_rowdatabound(object sender, gridviewroweventargs e) {     if (e.row.rowtype == datacontrolrowtype.footer)     {         dropdownlist ddlc = (dropdownlist)e.row.findcontrol("ddlcountry1");         dropdownlist ddls = (dropdownlist)e.row.findcontrol("ddlstate1");         if (ddlc != null)         {             bindcountry(ddlc, ddls);         }     }     if (e.row.rowtype == datacontrolrowtype.datarow && mygrid.editindex == e.row.rowindex)     {         dropdownlist ddlc = (dropdownlist)e.row.findcontrol("ddlcountry");         dropdownlist ddls = (dropdownlist)e.row.findcontrol("ddlstate");         if (ddlc != null)         {             cmd = new sqlcommand("select * m_country", con);             sqldataadapter da = new sqldataadapter(cmd);             datatable dt = new datatable();             da.fill(dt);             ddlc.datasource = dt;             ddlc.datatextfield = "countryname";             ddlc.datavaluefield = "c_id";             ddlc.databind();             ddlc.items.findbytext((e.row.findcontrol("lblcountry") label).text).selected = true;         }         if (ddls != null)         {             cmd = new sqlcommand("select * m_state", con);             sqldataadapter da = new sqldataadapter(cmd);             datatable dt = new datatable();             da.fill(dt);             ddls.datasource = dt;             ddls.datatextfield = "statename";             ddls.datavaluefield = "s_id";             ddls.databind();             ddls.items.findbytext((e.row.findcontrol("lblstate") label).text).selected = true;         }         radiobuttonlist rblg = (radiobuttonlist)e.row.findcontrol("rblgender");         rblg.items.findbytext((e.row.findcontrol("lblgender") label).text).selected = true;         checkboxlist chkh = (checkboxlist)e.row.findcontrol("chkhobby");         label ll = (label)e.row.findcontrol("lblhobby");         string ss = ll.text;         string[] ss1 = ss.split(new char[] { ',' }, stringsplitoptions.removeemptyentries);         foreach (string ss2 in ss1)         {             (int = 0; < 2; i++)             {                 if (ss2 == chkh.items[i].text)                 {                     chkh.items[i].selected = true;                 }             }         }     } } 


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -