User Profile & Activity

Joseph Paperman Member
Posted: April 17, 2014 1:11 PM

Ok, no need for the example, calling WebGrid1.ClientAction.Refresh() solved the problem. 


Thank you very much!

Posted: April 15, 2014 10:12 AM

It is the .Data.ID() method rsSchedule.Data.ID() 

But it might be easier for me to understand if we start from your example. 

Is your DoInsert method called from the Webgrid AddRow event? If so, after the method is called, what do you do with the returned OrderID parameter? How is it assigned to the webgrid?       

Posted: April 14, 2014 4:36 PM

In fact it is a 3rd party object that does the database commands. 

Here is the VB.NET code: 

Private Sub WebGrid1_AddRow(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.RowEventArgs) Handles WebGrid1.AddRow
    	Dim cells As New ISNet.WebUI.WebGrid.WebGridCellCollection
    	cells = e.Row.Cells
    	If cells.Item(0).Text <> "" Then		
    		   UpdateSchedule(cells)               				   
    	End If
End Sub
Private Sub UpdateSchedule(ByVal cells As ISNet.WebUI.WebGrid.WebGridCellCollection)
      
	Dim rsSchedule As TxAppFramework.Core.Metabase = New TxAppFramework.Core.Metabase(1000000110, TxSession)            
	rsSchedule.Data.Open()
	rsSchedule.Data.AddNew()
	rsSchedule.Data.Value("SERVICEMEMORANDUM_ID") = Context.Request("RecordID") 
	rsSchedule.Data.Value("TIME") = cells.Item(0).Text
	rsSchedule.Data.Value("V_PAP_CAR_TYPE_ID") = cells.Item(1).Value
	rsSchedule.Data.Value("ADDRESS") = UCase(cells.Item(2).Text)
	rsSchedule.Data.Value("DRIVER") = UCase(cells.Item(3).Text)
	rsSchedule.Data.Value("V_PAP_SCHED_TYPE_ID") = cells.Item(4).Value
	rsSchedule.Data.Value("NO_CARS") = cells.Item(5).Text
	rsSchedule.Data.Value("NOTES") = cells.Item(6).Text)	
	rsSchedule.Data.Update()
	
	'This is where the ID is read and set in the Grid cell
	cells.Item(8).Value = CStr(rsSchedule.Data.ID())  
	cells.Item(8).Text = CStr(rsSchedule.Data.ID())
	rsSchedule.Data.Close()
	rsSchedule = Nothing
End Sub

So the new identity is returned  by the "rsSchedule" object,

and is set as the value and text of the cell corresponding to the column that has the key field (index #8). Is there somewhere else it should be set?

Posted: April 11, 2014 11:01 AM

Hi, thank you for the reply. 

But no, it is there: 

<iswebgrid:WebGrid ID="WebGrid1" runat="server" DataMember="PAP_CAR_SCHEDULE" Width="776px" RenderingMode="HTML5" UseDefaultStyle="True">
    <RootTable DataKeyField="CAR_SCHEDULE_ID" CaptionImage="order-details.gif" TableHeaderVis     ible="True" Caption="Car Schedule" DataMember="PAP_CAR_SCHEDULE">
         ...
    </RootTable>
    ...
</iswebgrid:WebGrid>

 What I forgot to mention is that if I reload the page, the added row is there and can be edited just fine without giving errors. It happens only with rows that have just been added.


Finally got it working. When hitting "Copy SmartWebResource to Project Folder" in Deployment Manager, 

I realized it copied the DLLs to the root of the website, not in the Bin folder. 

After copying thoses DLLs from the root to the Bin folder, the message went away.

All times are GMT -5. The time now is 11:52 AM.
Previous Next