This is a migrated thread and some comments may be shown as answers.

Binding same datasource for RadGrid?

0 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Madhu Palakurthi
Top achievements
Rank 1
Madhu Palakurthi asked on 09 Jan 2013, 05:12 AM
Hi,

I have a unit combobox in the UI & contains data like  'Select All',   '001',   '002',  'IT' ...etc   ( pic1 from attached files ) .

When combo box value is 'Select All' then I am looping every unit and adding user control to RadPanelbar ...
UserControl has a grid and binding data based on unit and other parameter.

ASPX.vb:

Here I am creating object for usercontrol and adding to RadPanelBar ..
Here CboUnit -Unit ComboBox ,     
 pnlDDSummaryDept - RadPanelBar ,
DueDateSummarybyDept.ascx   -  Usecontrol has RadGrid
 
If RadTabStrip1.SelectedIndex = 0 Then
       ElseIf RadTabStrip1.SelectedIndex = 1 Then
           If cboUnit.SelectedItem.Text.Contains("Select All") Then
               Dim i As Integer = 0
               pnlDDSummaryByDept.Items.Clear()
               Do While (i < cboUnit.Items.Count)
                   If Not cboUnit.Items(i).Text.Contains("Select All") Then
                       Dim dateItem As New RadPanelItem()
                       dateItem.Text = cboUnit.Items(i).Text
                       pnlDDSummaryByDept.Items.Add(dateItem)
  
                       Dim control As New RadPanelItem()
                       Dim Panel1 As New Panel()
                       Session("DDByDeptCode") = cboUnit.Items(i).Text
                       Dim DDUCSummaryByDept As Control = FindControl("uxDDSummaryByDept" + i.ToString())
                       If DDUCSummaryByDept Is Nothing Then
                           DDUCSummaryByDept = LoadControl("DueDateSummarybyDept.ascx")
                           DDUCSummaryByDept.ID = "uxDDSummaryByDept" + i.ToString()
                           Panel1.Controls.Add(DDUCSummaryByDept)
                           control.Controls.Add(Panel1)
                           dateItem.Items.Add(control)
                       End If
                   End If
                   i = i + 1
               Loop

DueDateSummarybyDept.ascx :
<telerik:RadGrid DataSourceID="SqlDataSource1" ID="RadGrid3" runat="server" GridLines="None"
                       PageSize="20" AutoGenerateColumns="false">
                       <PagerStyle Mode="NumericPages"></PagerStyle>
                       <MasterTableView AutoGenerateColumns="false" Width="100%">
                           <Columns>
 ...........
</telerik:RadGrid>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TaskManagementConnectionString2 %>"
                       SelectCommandType="StoredProcedure">
                       <SelectParameters>
                           <asp:SessionParameter SessionField="UserName" Name="User" Type="String" />
                           <asp:SessionParameter SessionField="DDByDeptCode" Name="DepCode" Type="String" />
                       </SelectParameters>
                   </asp:SqlDataSource>

DueDateSummarybyDept.ascx.vb :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SqlDataSource1.SelectCommand = "rpt_DeptTaskListingPerDays"       
End Sub

But after running the application , I have checked query by using sql profiler is taking same Unit =' SM' for each loop .this unit is last unit from combo box.   ( pic2 from attached files )

Actually I have data for Unit ='IT' but still showing empty result. ( pic3,pic4 from attached files)

How can I do set sql datasource and display exact result based on unit.

Please help me on this ..

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Madhu Palakurthi
Top achievements
Rank 1
Share this question
or