David Modugno
asked on
rebind a grid after user clicks on node in treeview
I have an asp.net page with vb.net code behind (using telerik controls)
on my asp page I have a sql data source that is used to populate a grid... there is also a radtreeview on the page.. when a user selects a root node on the treeview I use code behind to determine a number that is selected and add the value to a public property.. that all works
I am trying to pass the number to my sql datasource as a parameter... for the life of me I cannot get this to work.. I have tried so many different things that I think i might have even messed things up that had been working lol...
Here is the sql data source in the asp page
Here is where I get the number I need to pass as a parameter (it is based on the text selected) after user clicks on a node in the treeview
the last thing i tried was adding the parameter add and rebind here... but it didnt work either..
Any help would be great.. thanks
on my asp page I have a sql data source that is used to populate a grid... there is also a radtreeview on the page.. when a user selects a root node on the treeview I use code behind to determine a number that is selected and add the value to a public property.. that all works
I am trying to pass the number to my sql datasource as a parameter... for the life of me I cannot get this to work.. I have tried so many different things that I think i might have even messed things up that had been working lol...
Here is the sql data source in the asp page
<asp:SqlDataSource ID="sqlDepartNumbers" runat="server" ConnectionString="<%$ ConnectionStrings:EmployeesConnectionString %>"
SelectCommand="SELECT [KField], [FirstName], [LastName], [Extension], [DID], [Fax], [DepartmentName] FROM [EmployeeInfo] WHERE (([DepartmentID] = @DepartmentID) AND ([IsDepartmentGeneral] = @IsDepartmentGeneral)) ORDER BY [FirstName]">
<SelectParameters>
<asp:Parameter Name="DepartmentID" Type="Int32"/>
<asp:Parameter DefaultValue="True" Name="IsDepartmentGeneral" Type="Boolean" />
</SelectParameters>
</asp:SqlDataSource>
Here is where I get the number I need to pass as a parameter (it is based on the text selected) after user clicks on a node in the treeview
Protected Sub RadTreeView1_NodeClick(sender As Object, e As RadTreeNodeEventArgs)
Dim strText As String = e.Node.Text
If strText = "Administration" Then
PubProp.DeptID = 3
'sqlDepartNumbers.SelectParameters.Add("@DepartmentID", PubProp.DeptID)
'grdDeptNumbers.Rebind()
RadPane2.Visible = False
HideLables()
RadPane3.Visible = True
ElseIf strText = "Family Practice" Then
PubProp.DeptID = 4
'sqlDepartNumbers.SelectParameters.Add("@DepartmentID", PubProp.DeptID)
RadPane2.Visible = False
HideLables()
RadPane3.Visible = True
Else
other stuff happens here if i cant find a number
End If
the last thing i tried was adding the parameter add and rebind here... but it didnt work either..
Protected Sub sqlDepartNumbers_Selecting(sender As Object, e As SqlDataSourceSelectingEventArgs) Handles sqlDepartNumbers.Selecting
'e.Command.Parameters("@DepartmentID").Value = PubProp.DeptID
sqlDepartNumbers.SelectParameters.Add("@DepartmentID", PubProp.DeptID)
End Sub
Any help would be great.. thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.