KnightHasan
Newcomer
- Joined
- Apr 28, 2005
- Messages
- 6
Hi all! I have the following three questions, the answers to which still elude me. Any help would be highly appreciated:
1. I have a DataGrid (firstly, with a disabled viewstate and secondly, the entire DataGrid is editable, with a single Button at the bottom instead of editing data one row at a time). This DataGrid displays rows from a table A in an Oracle database. When the Submit button is clicked, it will result in two actions:
(a) A csv file will get downloaded to the user's computer which will contain all the rows of the grid and at the same time these rows will be inserted into another table B.
(b) The entire grid will be recreated and reloaded. During the reload all the original rows will be loaded with the difference that since they have been downloaded to the user's computer, they will be colored differently(For this a query checks the table B). I have used OnItemDataBound event for this.
The problem is in step (b) during the reloading of data from the datasource. Although the code does reach the lines which color the rows (in OnItemDataBound event handler) and they get executed, yet when the page gets displayed finally, the rows appear with the original color. The change comes into effect only if I refresh the page through the browser.
Why is this happening and how can I make sure that the rows do get colored when the datagrid is reloading?
2. This is related to step 1. I want the background of the rows to get colored. For this I use the statement:
where e is of type DataGridItemEventArgs. Yet this does not work. But strangely, the forecolor does change using :
How can I change the BackColor?
3. Can I disable a custom GridRadioButtonListColumn inside a DataGrid so that selected radio is visible to the user but cannot be deselected/modified?
Thanks.
1. I have a DataGrid (firstly, with a disabled viewstate and secondly, the entire DataGrid is editable, with a single Button at the bottom instead of editing data one row at a time). This DataGrid displays rows from a table A in an Oracle database. When the Submit button is clicked, it will result in two actions:
(a) A csv file will get downloaded to the user's computer which will contain all the rows of the grid and at the same time these rows will be inserted into another table B.
(b) The entire grid will be recreated and reloaded. During the reload all the original rows will be loaded with the difference that since they have been downloaded to the user's computer, they will be colored differently(For this a query checks the table B). I have used OnItemDataBound event for this.
The problem is in step (b) during the reloading of data from the datasource. Although the code does reach the lines which color the rows (in OnItemDataBound event handler) and they get executed, yet when the page gets displayed finally, the rows appear with the original color. The change comes into effect only if I refresh the page through the browser.
Why is this happening and how can I make sure that the rows do get colored when the datagrid is reloading?
2. This is related to step 1. I want the background of the rows to get colored. For this I use the statement:
Code:
e.Item.BackColor = Color.DodgerBlue;
Code:
e.Item.ForeColor = Color.DodgerBlue;
3. Can I disable a custom GridRadioButtonListColumn inside a DataGrid so that selected radio is visible to the user but cannot be deselected/modified?
Thanks.