Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to checkbox checked in gridview when gridview is loaded.
there is value true and false stored in database.


i use the function for check the user and bit value but it true for all other. it can not true for specific user and his row.

code is:
C#
protected bool subProgram(string str)
    {
        int i=1;
        string s11 = "Select bit_indicator,category,subctgry from document_rights where user_id='" + drop_user.SelectedItem.Value + "' and bit_indicator='" + i + "' and category='"+drop_cat.SelectedItem.Value+"' and sub_cat='"+drop_sub_cat.SelectedItem.Value+"'";
        SqlDataAdapter ad2 = new SqlDataAdapter(s11, c.getcon());
        DataSet ds2 = new DataSet();
        ad2.Fill(ds2);
        if (ds2.Tables[0].Rows.Count != 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }


i wan to check only specific user... so what can i dooo now.....

so please help me..
Thanksssss ....
Posted
Updated 26-Apr-12 21:37pm
v3

Read the database. Set the checkbox.

Or: Improve your question to point us at the problem.

After question edit:
Your string concatenation doesn't work at the part bit_indicator='" + i + "' and category. You need to convert i to a string using i.ToString().
 
Share this answer
 
v2
Comments
[no name] 27-Apr-12 4:50am    
But sir it checked all the checkbox whether condition for it satisfied or not. in this case row data bound useful when grid is loaded ?

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