How do i clear the Sfdatagrid rows.. i try some ways but it doesnot works.. it repeats the same records
'---Transaction bill Load Query---
Private Sub transHistoryLoad()
Dim constring As String = AlgoMdConnectionString
Try
Using con As New SqlConnection(constring)
Using cmd As New SqlCommand("
--- Payment History
SELECT
Convert(Date,TAVH_VOUCHERDT) AS [PAYMENT DATE],
TAVH_VOUCHERNO AS [Voucher No],
Case when TAVH_VOUCHERCODE=1001 then 'Bill Wise Payment'
when TAVH_VOUCHERCODE=1003 then 'Advance Payment'
else 'Payment' end AS [Payment Type],
LedgerCode.TALM_LedgerName AS [Paid to],
OppLedgerCode.TALM_LedgerName AS [Paid through],
TAVH_AMOUNT AS [Paid Amount],
TAVH_NARRATION AS [Narration],
'False' AS [isClosed]
from Tbl_AccVoucherHdr2019_2020
INNER JOIN Tbl_AccLedgerMaster LedgerCode
ON LedgerCode.TALM_LedgerCode = TAVH_PartyLedgerCode
INNER JOIN Tbl_AccLedgerMaster OppLedgerCode
ON OppLedgerCode.TALM_LedgerCode = TAVH_PrimaryLedgerCode
Where TAVH_VOUCHERCODE in (1001,1003)
", con)
cmd.CommandType = CommandType.Text
Using sda As New SqlDataAdapter(cmd)
sda.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
grdMain.Columns.Add(New GridCheckBoxColumn() With {.MappingName = "isClosed", .HeaderText = "isClosed", .CheckBoxSize = New Size(15, 15), .TrueValue = "True", .FalseValue = "False"})
TryCast(Me.grdMain.Columns("isClosed"), GridCheckBoxColumn).AllowCheckBoxOnHeader = True
Me.grdMain.Columns("isClosed").HeaderText = String.Empty
Me.grdMain.Columns("isClosed").AllowEditing = True
grdMain.DataSource = ds.Tables(0)
AddHandler grdMain.View.RecordPropertyChanged, AddressOf OnRecordPropertyChanged
Else
Dim info As New FrmInfoMsgBox
info.lblmsg.Text = "Sorry, No Transaction found."
info.ShowDialog()
End If
End Using
End Using
End Using
Catch ex As Exception
IO.File.AppendAllText(appDataPath & "\Log.txt", String.Format("{0}{1}", Environment.NewLine, ex.ToString()))
Dim x As New FrmErrorMsgBox
x.txterrormsg.Text = ex.Message.ToString
x.ShowDialog()
End Try
End Sub
Private Sub btnRefresh_Click(sender As Object, e As EventArgs) Handles btnRefresh.Click
Me.grdMain.DataSource = Nothing
Me.grdMain.DataMember = Nothing
Me.grdMain.UnboundRows.Clear()
Me.grdMain.Columns.Clear()
transHistoryLoad()
Me.grdMain.Refresh()
End Sub
Above 'btnRefresh' is a clear and refresh statement i had given.
the columns get cleared successfully, but rows are not get clearing.. Its just adding the records within the old records..
I try Me.grdMain.View.Records.Clear() method, but it returns an error..
SIGN IN To post a reply.
8 Replies
VS
Vijayarasan Sivanandham
Syncfusion Team
February 15, 2020 03:31 AM UTC
Hi sulthan,
We have analyzed your query that rows when the grid is not cleared. We have tried to replicate your scenario but we are unable to reproduce the reported issue from our end.
Please find the tested sample and video demo from our end in the below link
If still you are facing the same issue, can you please share us below things?
1. Code files related to you command
2. Brief replication procedure/video illustration of the reported issue
Also, if possible, can you please revert us with the modified sample? It will help us to investigate further and provide appropriate solution at earlier.
Regards,
Vijayarasan
SU
sulthan
February 20, 2020 10:55 AM UTC
MK
Muthu Kumaran Gnanavinayagam
Syncfusion Team
February 21, 2020 02:08 PM UTC
Hi Sulthan,
Currently we are validating the reported query at our end and will update further details on or before 25th February, 2020. We will highly appreciate your patience until then.
Regars,
G.Muthu kumaran.
SS
Susmitha Sundar
Syncfusion Team
February 25, 2020 12:58 PM UTC
Hi Sulthan,
Thank you for your patience.
We have prepared the sample based on your provide code and cant able to reproduce your reported scenario. Please refer the below sample,
Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with the following details,
- SfDataGrid settings
- Syncfusion updated version
It will be helpful for us to check on it and provide you the solution at the earliest.
Regards,
Susmitha S
Hi Sulthan,Thank you for your patience.We have prepared the sample based on your provide code and cant able to reproduce your reported scenario. Please refer the below sample,Please check the sample and let us know if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with the following details,
- SfDataGrid settings
- Syncfusion updated version
It will be helpful for us to check on it and provide you the solution at the earliest.Regards,Susmitha S
I cannot able to view the URL link that you sent before.. Please, kindly find the attachment below.
Attachment: Untitled_fab7048a.zip
FP
Farjana Parveen Ayubb
Syncfusion Team
March 12, 2020 11:59 AM UTC
Hi Sulthan,
Sorry for the inconvenience caused.
We can able to download the sample from our previous link, please refer the below link for sample.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGrid_WF269623481578054553
Regards,
Farjana Parveen A
SU
sulthan
March 12, 2020 01:16 PM UTC
Thanks for the help. I rectified the mistake. It was that Datatable or Dataset should be cleared before loading the records again.
I used Datatable.Clear() with following codes for clearing the records on Sfdatagrid before loading the SQL Query value.
SS
Susmitha Sundar
Syncfusion Team
March 13, 2020 01:37 PM UTC
Hi sulthan,
Thanks for the update.
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you.
Regards,
Susmitha S
SIGN IN To post a reply.
- 8 Replies
- 5 Participants
-
SU sulthan
- Feb 13, 2020 02:29 PM UTC
- Mar 13, 2020 01:37 PM UTC