I have a table in dataabase with 10 columns and these 10 columns are input fields in web page. Now base on certain type of users who is accessing the web page I need to show only certain fields and I also need to change the order in which these fields are displayed in web page. I can show or hide input fields but I am not sure how to reorder input fields based on certain condition. Is it possible to do something using asp.net on server side or do i need to use jquery and how can we acheive this?
1 Answer
Without seeing any of your code, if you even have any, then I would suggest something along these lines:
Have conditional logic for querying the data, based upon the type of user (read: role), like this:
switch (user.Role)
{
case "Customer":
// Call customer stored procedure to return data pertinent to Customers
// Returns List<T>, DataSet, DataTable, etc.
break;
case "Admin":
// Call admin stored procedure to return data pertinent to Admins
// Returns List<T>, DataSet, DataTable, etc.
break;
case "SuperUser":
// Call super-user stored procedure to return data pertinent to Super Users
// Returns List<T>, DataSet, DataTable, etc.
break;
}
// Apply the data structure (List<T>, DataSet, DataTable, etc.) to your display, like this:
GridView.DataSource = dataSource;
GridView.DataBind();
1 Comment
09999
But all those columns dataentry fields in web page like textboxes checkboxes etc..... now i want to change the order of this input controls based on condition................