| Author: gujju 12 Aug 2004 | Member Level: Silver | Rating: Points: 2 |
Got the Function....
here it is...if some one wants it.. Just steal it man.... :)
Imports System.Web.UI
Public Sub ClearControls(ByVal control As Control) 'This function is used to Clear all the controls in the datagrid 'Will Clear all the ServerControls Which are in the Datagrid 'Such as edit command, paging, checkboxes in datagrid and all 'the server controls 'it will replace the server control with simple text for that control 'Where Can this be Used: 'Exporting Datagrid and Clearing Datagrid Dim i As Integer For i = control.Controls.Count - 1 To 0 Step -1 ClearControls(control.Controls(i)) Next i
If Not TypeOf control Is System.Web.UI.WebControls.TableCell Then If Not (control.GetType().GetProperty("SelectedItem") Is Nothing) Then Dim literal As New LiteralControl control.Parent.Controls.Add(literal) Try literal.Text = CStr(control.GetType().GetProperty("SelectedItem").GetValue(control, Nothing)) Catch End Try control.Parent.Controls.Remove(control) Else If Not (control.GetType().GetProperty("Text") Is Nothing) Then Dim literal As New LiteralControl control.Parent.Controls.Add(literal) literal.Text = CStr(control.GetType().GetProperty("Text").GetValue(control, Nothing)) control.Parent.Controls.Remove(control) End If End If End If Return End Sub 'ClearControls
|
| Author: MuthuKumar 12 Aug 2004 | Member Level: Bronze | Rating: Points: 2 |
Hi pls look this link you can get better idia about this
http://www.dotnetjohn.com/articles/articleid78.aspx
bye Muthu Kumar
|