Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to select more than one value from Checkboxlist and save them in Gridview....

I have checkboxlist which is having UG,PG,PhD/Mphil values in it...
I have to select more than one from the checkboxlist and display them in single cell of the Gridview...
How to do...
C#
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {

        if (e.CommandName == "Edit")
        {
            int index = Convert.ToInt32(e.CommandArgument);



string Education = GridView1.Rows[index].Cells[6].Text.Trim();

if (Education== "Diploma")
{
Edu_ChkBxLst.SelectedItem.Text = GridView1.Rows[index].Cells[6].Text.Trim();
}
if (Education== "UG")
{
Edu_ChkBxLst.SelectedItem.Text = GridView1.Rows[index].Cells[6].Text.Trim();
}
if (Education== "PG")
{
Edu_ChkBxLst.SelectedItem.Text = GridView1.Rows[index].Cells[6].Text.Trim();

}
if (Education== "MPhil/PhD")
{
Edu_ChkBxLst.SelectedItem.Text = GridView1.Rows[index].Cells[6].Text.Trim();
}
Posted
Updated 26-Feb-14 1:25am
v3
Comments
OriginalGriff 26-Feb-14 6:51am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
What the heck are you trying to split?
Where are you stuck?
Use the "Improve question" widget to edit your question and provide better information.
Kornfeld Eliyahu Peter 26-Feb-14 6:58am    
OT - let me suggest you a shortcut...
Edu_ChkBxLst.SelectedItem.Text = GridView1.Rows[index].Cells[6].Text.Trim();

1 solution

Use row data bind event of grid view.

Get string Education after that search for it in check box list and select it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900