:: Forum >>

Dynamically update grid content

Hi all..

I created grid with vb.net dataset. After entering data into grid. i am sending data to server through ajax and calculating it. After that i need to update the grid with new dataset. I am calculating the data but how i can update the grid? My grid structre is same before and after calculating.

This is the code i am generating the grid through vb

Dim m_calVal As BLL.CalVal
Dim dSet As DataSet
m_calVal = New BLL.CalVal(CURRENT_MODELID)
dSet = m_calVal.GetDataSet
dtGrid = dSet.Tables("CalVal")

Dim strHeaders As String = ""
Dim strCells As String = ""

Dim i As Integer = 0
Dim count As Int64 = 0
Dim headers() As String
Dim strScript As String = ""

count = dtGrid.Columns.Count
ReDim headers(count - 1)
For i = 0 To count - 1
headers(i) = aw_string(dtGrid.Columns(i).ColumnName)
Next

strHeaders &= "[" & Join(headers, ", ") & "];"

Dim col_count As Integer = 0
Dim row_count As Integer = 0
Dim columns() As String
Dim rows() As String
Dim x As Int64 = 0

row_count = 0
col_count = dtGrid.Columns.Count
ReDim columns(col_count - 1)

For x = 0 To dtGrid.Rows.Count - 1
For i = 0 To col_count - 1
columns(i) = aw_string(dtGrid.Rows(x)(i))
Next
ReDim Preserve rows(row_count)

rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1
Next
strCells = "[" & vbNewLine & Join(rows, "," & vbNewLine) & vbNewLine & "];" & vbNewLine

strScript = "<script>aw_headers=" & strHeaders & ";"
strScript &= "aw_cells=" & strCells & ";</script>"

Me.RegisterStartupScript("Startup", strScript)

after sending back the grid data and calculating it in server i am sending

Dim m_calVal As BLL.CalVal
Dim dSet As DataSet
m_calVal = New BLL.CalVal(CURRENT_MODELID)
dSet = m_calVal.GetDataSet
dtGrid = dSet.Tables("CalVal")

Dim strHeaders As String = ""
Dim strCells As String = ""

Dim i As Integer = 0
Dim count As Int64 = 0
Dim headers() As String
Dim strScript As String = ""

Dim col_count As Integer = 0
Dim row_count As Integer = 0
Dim columns() As String
Dim rows() As String
Dim x As Int64 = 0

row_count = 0
col_count = dtGrid.Columns.Count
ReDim columns(col_count - 1)

For x = 0 To dtGrid.Rows.Count - 1
For i = 0 To col_count - 1
columns(i) = aw_string(dtGrid.Rows(x)(i))
Next
ReDim Preserve rows(row_count)

rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1
Next
strCells = "[" & vbNewLine & Join(rows, "," & vbNewLine) & vbNewLine & "];" & vbNewLine

Return strCells

now in javascript i am catching that strCells into dSet
means dSet = strCells
After that my javascript code is

aw_cells= dSet;
obj.refresh();

But my grid is not getting refresh .
Help me to solve this problem.
Satyendra Kumar Panasa
Tuesday, September 18, 2007
I too have same problem. Please any one help me to solve this problem
Ram
Wednesday, September 19, 2007
Hi,

Putting your web address in the subject line makes it difficult for anyone to access this topic.
Sumit
Wednesday, September 19, 2007
To clarify my earlier post, a post with you web address in the subject line redirects the browser to your website instead of letting them access your board message.
Sumit
Wednesday, September 19, 2007
(I have removed the link from the subject line, sorry :-)

After you have received the new data you should put it into the grid -

grid.setCellText(newArray);
grid.refresh();
Alex (ActiveWidgets)
Wednesday, September 19, 2007

This topic is archived.


Back to support forum

Forum search