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

[Solved] radgrid edit function hiding grid

2 Answers 333 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 13 Feb 2013, 08:16 PM
I know what the problem is but do not know how to fix it as I have never run into doin git this way.  i have a global boolean variable Fillgrid that is set to true when they click on a view button that allows the grid to be show and rebind.  But when i click on the edit link to show the inline edit form, the grid disappears but if I click on the view button agian it appears with the inline editing open.  It has to do with the edit button but dont know where to put the show fillgrid boolean statement.
<telerik:GridEditCommandColumn UniqueName="UpdateCommandName" ButtonType="ImageButton" EditImageUrl="../Images/edit_icon.png"></telerik:GridEditCommandColumn>
 
 
<EditFormSettings EditFormType="Template" FormMainTableStyle-HorizontalAlign="Center" FormCaptionStyle-BorderColor="Black" FormMainTableStyle-BackColor="#B0C4DE">
 
<FormTemplate>
     <table class="GridEdittemplate">

 

Protected Sub myRadGrid_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles myRadGrid.NeedDataSource
       Dim UserLogon As String = Split(Current.User.Identity.Name, "\")(1)
       Dim sqlWhere As String = ""
       Dim name As String = HFID.Value.ToString
       Dim Counter As Integer = 0
 
       If FillGrid = True Then
             FILL radgrid with sql statement
            myRadGrid.DataSource = getdata(sql)
        end if

So my problem is when I click on teh edit button it blanks out the grid and it becomes invisible and it has to do with posting back and showing the edit form but how can i pass in teh fillgrid boolean statement.

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 13 Feb 2013, 08:22 PM
Hi,
Nevermind figured it out with these radgrid subs
Protected Sub myRadGrid_CancelCommand(sender As Object, e As GridCommandEventArgs) Handles myRadGrid.CancelCommand
       FillGrid = True
   End Sub
 
   Protected Sub myRadGrid_EditCommand(sender As Object, e As GridCommandEventArgs) Handles myRadGrid.EditCommand
       FillGrid = True
   End Sub
 
   Protected Sub myRadGrid_GridExporting(sender As Object, e As GridExportingArgs) Handles myRadGrid.GridExporting
       FillGrid = True
   End Sub

0
Andrey
Telerik team
answered on 18 Feb 2013, 01:34 PM
Hi,

This is one way to achieve the goal, however, the preferable way is to bind the grid always and just set its Visible property to true or false on button click. Thus you won't need to manually feed the Grid with data every time when it needs data. That the NeedDataSource event is for.

Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or