I have a situation where where I need to only fired the needDatasource on a boolean statment. It works fine for what I am doing to load the page on a querystring value. Where the grid hiccups is when I try to use the Radgrid insert, the grid disappears becuase of the boolean statment, how can I set this statement when I postback to get at my template to insert data.
Dim fillGridNotes As Boolean = False
Dim fillGridEmer As Boolean = False
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim rspId As String = Request.QueryString("RSP")
If rspId = String.Empty Then
'Send to another page
Else
Dim userlogon As String = Split(Current.User.Identity.Name, "\")(1)
HFUserId.Value = GetPersId(userlogon)
HFRecruitId.Value = rspId
LoadRSP(rspId)
fillGridNotes = True
End If
End If
End Sub
This is where I cannot ge thte grid to open to allow me to fill out the form and then postback to fill the grid.
Protected Sub myRadNotes_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles myRadNotes.ItemCommand
If (e.CommandName = RadGrid.PerformInsertCommandName) Then
fillGridNotes = True
Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
Dim notes As TextBox = DirectCast(editedItem.FindControl("txtNotes"), TextBox)
Dim rspId As Integer = 16533
sql = "Insert tblRSPNotes (intRSPId, dtRSpNotesDateEntered, strRSPNotesDesc, intLoggedBy) VALUES (" & rspId & ", '" & Date.Now & "', '" & sanitizeString(notes.Text) & "', " & HFUserId.Value & ")"
insertUpdateDelete(sql)
myRadNotes.Rebind()
End If
End Sub
Protected Sub myRadNotes_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles myRadNotes.NeedDataSource
'Load the Notes Grid
If fillGridNotes = True Then
sql = "Select intRspNotesId, CONVERT(varchar(10), dtRSPNotesDateEntered, 111) dtNotes, strRSPNotesDesc, mn.strFullname + ' ' + ISNULL(' ' + strRank, '') LoggedBy from tblRSPNotes n LEFT JOIN MNNGPersonnel..tblMNNatPersonnel mn on " _
& "mn.intPersonnelId = n.intLoggedBy where intRSPID in (Select intRSpId from tblRSp where intRecruitId = " & HFRecruitId.Value & ") Order by dtRSPNotesDateEntered DESC"
myRadNotes.DataSource = getReader(sql)
End If
End Sub