This is a migrated thread and some comments may be shown as answers.

Loosing data on postback

2 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arnaud
Top achievements
Rank 1
Arnaud asked on 19 Nov 2010, 10:15 PM
I have gridview that i programatically bind to a data-table. one of my column is an hyperlink column that is manually set to show the text "Update" on each row.
I created the following code in the page load event to disable the hyperlink for the appropriate columns:

'Carry out steps to figure if a each report is invoiced or not.

 

'If invoiced, the update hyperlink is disabled

 

 

Dim number_of_reports As Integer = RadGrid1.Items.Count

 

 

For i = 0 To number_of_reports - 1

 

 

If RadGrid1.Items(i)("status_column").Text = "Not Invoice" Then

 

RadGrid1.Items(i)(

"update_column").Enabled = False

 

RadGrid1.Items(i)(

"update_column").Text = "No"

 

 

End If

 

 

Next

 


At the page load event the code is handled well. But when i change pages, a postback occurs and the hyperlinks are all reset to the text "update".

I tried putting the code in the radgrid1.page_index_change event but it still does not work.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Nov 2010, 07:19 AM
Hello Arnaud,


A better approach is trying the code in ItemDataBound than in PageLoad. The  following links will help you in accessing cell value in ItemDataBound event.
Accessing cells and rows.
Grid / Accessing Cells and Rows

Hope this helps

Regards,
Shinu.
0
Arnaud
Top achievements
Rank 1
answered on 07 Dec 2010, 07:35 PM
I forgot to thank you. It worked after reviewing the demos.
Tags
Grid
Asked by
Arnaud
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arnaud
Top achievements
Rank 1
Share this question
or