Hello,

Can any1 tell me how i can change the field/column name on a datagrid only for the web interface. I set the field names for the database with no space in between words but when i display the data on the web page i want it to appear differently. Alot of professionals do not have spaces in their field/column names in tables as it can cause problems when programming/development. another problem i have is that how can i add a scroll bar to my data grid, if i cnt then which control can i use that has a scroll bar instead of having a scroll bar for the entire web page which i do not want. also when a user logs into the system, i want it to display their information (only theirs). how can i do that? so far i created a asp.net login page that uses the login controls. it has a username field that displays the users name so i decided to match that user with the existing data in a table db, but it does not work as it is looking for a ID field, which 'Username' is not an ID field. Can you please help me any of these problems. i urgently need ur help. thnx in advance. see attachment for more detail.

You can specify the header template dynamically, just declare the datagrid, and call the header template, and apply it as you see fit. This way you control it, not the grid.

To put a scrollbar in, you need to use a div. The div will contain the datagrid. The div should have autoflow of "auto" and a pre-set height. This way, if it is below the height of the div, no scrollbar will be shown. However, if it is larger, then it will scroll, but ONLY in the div.

<div style="autoflow:auto;height:300px;">
<asp:DataGrid..... />
</div>

As for the user information, you need to select the information from the database, based upon the username. Such ways are:

SELECT * FROM Users WHERE UserName=THEUSERNAME

Then you can grab the info you need.

If you need further help, just respond with what you need.

Thanx for your help.

The scroll bar is not appearing on the web page for the datagrid. for some reason i cannot set the height size of the div smaller than the datagrid height size to display a scroll bar. as u said earlier that if it is larger, then it will scroll. please help.

do you have ideas about how i could write the value (studentID) entered into login page into an access table within the asp.net? i have a access db connected to my web application and was wondering if i could copy the value into a table and set that field to a key so that i can then link that value from the table to the studentdetails data grid. in ASP.net when u want to show information for a particular record in a datagrid, all the datagrids or other controls need to be linked using the 'datakeynames' which needs to be a key. in my case, i am using a asp login, which does not allow or shows me the code that is used to authenticate users and then displays their name on the next screen. the field that displays the users name is not a key so there fore i need to copy this into a table and set as a key then display in a datagrid and then link to another datagrid to display right informatin. can i send u my whole web application?

please help

change the div's overflow to scroll:

overflow:scroll;

And unfortunately I am not familiar with asp.net membership. So I cannot help you in that aspect. Sorry.

Hello,

how can i create my own login web page? so that i could write any code i want rather than using asp login control which i cant use to compare the user with my database.

any ideas.

scroll bar is working but i only want it for the height not width, so how can i set this.

tnx

create your own login page? Quite simple. Gather the person's info (username, pass) from texboxes, run a query against the database searching for:

SELECT userpassword FROM users WHERE username=@username

commandname.Parameters.AddWithValue("@username", Trim(username.text))

Then after you receive the password, do a string compare:

string.compare(password, Trim(password.text), false)

If that equals 0, then it passes. Otherwise it failed and it is not the right password.

For your scrollbar issue, this works in most IE and MOZilla, you'll have to test the rest:

<div style="overflow:auto;overflow-x:hidden;overflow:-moz-scrollbars-vertical;"></div>

This article has been dead for over six months. Start a new discussion instead.