0

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
  • Try with asp.net data control such as grid, and use bind with textbox and changes the order of strings As required in code behind Commented Aug 16, 2013 at 19:41

1 Answer 1

1

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();
Sign up to request clarification or add additional context in comments.

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.