Click here to Skip to main content
15,741,892 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:
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();
        if (ds2.Tables[0].Rows.Count != 0)
            return true;
            return false;

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

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

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
[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