I had Gridview bind sqldatasource and I had logins which see gridview and I made roles for these logins som of them cannot see all gridview column so how can I make some columns read only .?
code
public void CheckLoginAuthorty()
{
using (SqlConnection Con = Connection.GetConnection())
{
SqlCommand com = new SqlCommand("CheackLoginInRole", Con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add(Parameter.NewNVarChar("@Login", Session.Contents["Username"].ToString()));
object O = com.ExecuteScalar();
if (O != null)
{
string S = O.ToString();
if (IsInRole("AR-Translator", O.ToString()))
{
///////// Grideview code/////////////////
}
else if (IsInRole("EN-Translator", O.ToString()))
{
/////////Grideview code/////////////////
}
}
}
}
EDIT:
All you need to do is set the
ReadOnlyproperty totruee.g.
WinForms DataGridView
WebForms GridView