Hi Experts,
I've problem to get data into the grid when the PostBack is Async. When it's Sync, there is no problem.
There is a search section and the result is shown into the grid. I would like to refresh only the grid, not the entire web page. The grid is filled by a DataSource. The grid is under updatePanel tags with a trigger.
Any suggestions would be appreciate.
Thks.
Hi pmrenaud,
If you set EnableAjax to "false" does it work for you?
Unfortunatly not!
Here is the source code from aspx.vb:
-----------------8<-------------------------8<-------------- Private Sub btnRecherche_Click(sender As Object, e As System.EventArgs) Handles btnRecherche.Click
If (ScriptMgr.IsInAsyncPostBack) Then
Dim fourn As New clsFournisseur
With fourn
.C_four_no = txtNo.Value.ToString().Trim()
.C_four_nom = txtNomF.Text.Trim()
.C_four_tel = txtPhone.Value.ToString().Trim() ' Text.Trim()
.C_four_vil = txtVil.Text.Trim()
If (cbDiscipl.ValueField() = "") Then
.C_ref_discipline.C_discipline_no = 0
Else
.C_ref_discipline.C_discipline_no = CInt(cbDiscipl.ValueField())
End If
If (cbSect.ValueField() = "") Then
.C_ref_secteur.C_secteur_no = 0
.C_ref_secteur.C_secteur_no = CInt(cbSect.ValueField())
.C_four_flag_sous_traitant = chkST.Checked
End With
executeSearch(fourn)
End Sub
Private Sub executeSearch(ByVal itemsSearch As clsFournisseur)
'Chargement des données dans la grille du registre
Dim fournList As Collection = SQLFactory.getTBFournisseurInstance().selectListFournisseur(itemsSearch)
Dim list = New List(Of recordRow)
For i = 1 To fournList.Count
Dim record = New recordRow
With CType(fournList(i), clsFournisseur)
record.no = .C_four_no.Trim() ' No fournisseur
record.nom = .C_four_nom.Trim() ' Nom
record.ville = .C_four_vil.Trim() ' Ville
record.tel = .C_four_tel.Trim() ' No tél
record.contact = .C_four_contact_nom_cpl.Trim() ' Nom contact
If (.C_ref_discipline.C_discipline_no > 1) Then
record.discipline = .C_ref_discipline.C_discipline_nom.Trim() ' Nom Discipline
If (.C_ref_secteur.C_secteur_no > 1) Then
record.secteur = .C_ref_secteur.C_secteur_nom.Trim() ' Nom secteur
record.soustraitant = .C_four_flag_sous_traitant ' Est sous-traitant
list.Add(record)
Next
'dgRegistryGrid.Rows.Clear()
dgRegistryGrid.DataSource = listdgRegistryGrid.DataBind()
-----------------8<-------------------------8<--------------
And here is the source code from aspx
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<ig:WebDataGrid ID="dgRegistryGrid" runat="server" CssClass="gridRegistry"
StyleSetName="Windows7" BorderColor="Black" BorderStyle="Solid"
BorderWidth="1px" AutoGenerateColumns="False" Font-Size="8pt" Height="300px"
EnableDataViewState="True" TabIndex="8" EnableAjax="False"
EnableAjaxViewState="False">
<Columns>
<ig:BoundDataField DataFieldName="no" Key="no" Width="70px" EnableMultiline="True">
<Header Text="No"></Header>
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="nom" Key="nom" Width="240px">
<Header Text="Nom"></Header>
<ig:BoundDataField DataFieldName="ville" Key="ville" Width="150px">
<Header Text="Ville"></Header>
<ig:BoundDataField DataFieldName="tel" Key="tel" Width="115px">
<Header Text="Téléphone"></Header>
<ig:BoundDataField DataFieldName="contact" Key="contact" Width="150px">
<Header Text="Contact"></Header>
<ig:BoundDataField DataFieldName="discipline" Key="discipline" Width="100px">
<Header Text="Discipline"></Header>
<ig:BoundDataField DataFieldName="secteur" Key="secteur" Width="100px">
<Header Text="Secteur"></Header>
<ig:BoundCheckBoxField DataFieldName="soustraitant" Key="soustraitant">
<Header Text="Sous-traitant"></Header>
</ig:BoundCheckBoxField>
</Columns>
<AjaxIndicator Enabled="True" ImageUrl="~/Outils/RegistreFournisseur/img/ajax-loader.gif" />
<Behaviors>
<ig:Selection CellClickAction="Row" RowSelectType="Single" Enabled="true"></ig:Selection>
<ig:ColumnResizing></ig:ColumnResizing>
<ig:Paging PagerAppearance="Bottom" PagerMode="NumericFirstLast" QuickPages="5" PageSize="50" FirstPageText="Première" LastPageText="Dernière" Enabled="False"> </ig:Paging>
</Behaviors>
</ig:WebDataGrid>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRecherche" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Thks!
I have created a sample for you which hopefully describes your scenario, however I did not encounter any issues.
Can you be more specific on what issue you are experiencing: is the grid not updating with the search results correctly upon clicking your button or is it not refreshing at all ?
Best Regards,
Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://www.infragistics.com/support
Nice, now It works.... (I can't say why, I used your code) Thks!
Nice, now It works.... (I can't say why, I used your code)
I'm glad that your issue is solved. Please contact me if you have any more questions.
I see that you have EnableAjax set to false. Is there a way to get UpdatePanels refreshed while having EnableAjax=true?
I have to leave EnableAjax set to True to resolve view state issue. Thx