Add a OnRowDataBound event handler to the GridView.
Add a OnRowDataBound event handler to the GridView In the event handler - check for the header and process each column accordingly protected virtual void OnRowDataBound(GridViewRowEventArgs e) { if (e.Row. RowType == DataControlRowType. Header) { // process your header here.. } } For more info go here: msdn.microsoft.com/en-us/library/system.....
1 Add the image to the headertemplate and in the onrowdatabound event hide it or assign it with a url. – anami Jul 7 at 16:41.
I'm not exactly sure how to add images... but this link has a good example of writing numbers in the row headers, so you could update it with the >10 condition, to display your image.
I don't want to add number to row header. I want to add different image add row header in different occasion. It check on read cell content.
Can you help me...... – Hemal Jul 7 at 16:40 oh sorry I missed the cell value check, I'm not sure if you can do that through this event. Sorry! – nEm Jul 7 at 16:49.
You can add images to DataGridView row headers in the DataGridView. RowPostPaint event. Here's a link to an article on CodeProject that appears to describe this fairly well (I haven't tried to code myself): Row Header Cell Images in DataGridView You can use the RowPostPaint event to extract the value you want to test against to determine which icon you want to display.Do this by using the event's RowIndex property with the index value of the column you're interested in.
Something like this should serve as a starting point: private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { // As an example we'll check contents of column index 1 in our DGV. String numberString = dataGridView1.Rowse.RowIndex. Cells1.
Value as string; if (numberString! = null) { int number; if (Int32. TryParse(numberString, out number)) { if (number > 10) { // Display one icon.
} else { // Display the other icon. } } else { // Do something because the string that is in the cell cannot be converted to an int. } } else { // Do something because the cell Value cannot be converted to a string.
} }.
Thnks a lot. This one useful for my program.....thnx again... – Hemal Jul 7 at 18:32.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.