I have been trying to load details tables where they exist. (fault tickets for a session)
I can expand all of the details tables, but they never contain any details.
I think that the problem is to do with the loading order due to the fact that I can expand all the deets tables but they contain no data.
I have tried setting the HeirachyLoadMode="Client" in the mastertableview and in the gridtableview.
The C#, then the asp.net are below.
I'm relatively new to this and any help would be appreciated
I can expand all of the details tables, but they never contain any details.
I think that the problem is to do with the loading order due to the fact that I can expand all the deets tables but they contain no data.
I have tried setting the HeirachyLoadMode="Client" in the mastertableview and in the gridtableview.
The C#, then the asp.net are below.
I'm relatively new to this and any help would be appreciated
protected
void
HelpdeskGrid_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataSet dataset =
new
DataSet();
SqlConnection conn =
new
SqlConnection(ConfigurationManager.ConnectionStrings[
"SiteSqlServer"
].ConnectionString);
int
nCompany =
int
.Parse(UserInfo.Profile.GetPropertyValue(
"Company"
));
try
{
conn.Open();
SqlDataAdapter adapter =
new
SqlDataAdapter();
string
strSql=
string
.Format(
"select top 100 s.SessionID as SessionID,co.Name as Company,cp.Name as Campaign,ca.FirstName,ca.LastName,ca.Email,ca.PhoneNo,s.Start,{1} as Status "
+
"from appSession s inner join appCandidate ca on s.CandidateID=ca.CandidateID "
+
"inner join appCampaign cp on s.CampaignID=cp.CampaignID "
+
"inner join appCompany co on s.CompanyID=co.CompanyID "
+
"where (s.CompanyID={0:d} or {0:d}=-1)"
,nCompany,Helpers.SqlStatusCodes(
"s"
));
string
strWhere =
" and 1=2"
;
if
(!
string
.IsNullOrWhiteSpace(txtSearch.Text))
{
strWhere=
string
.Format(
" and s.CandidateID in (select CandidateID from appCandidate where Contains(ca.SearchText,'{0}'))"
, Helpers.FixSearchString(txtSearch.Text));
}
strSql += strWhere;
strSql +=
" order by s.Start desc"
;
adapter.SelectCommand=
new
SqlCommand(strSql,conn);
DataTable dataTable =
new
DataTable();
adapter.Fill(dataTable);
DataColumn[] PrimaryKeys =
new
DataColumn[1];
PrimaryKeys[0] = dataTable.Columns[
"SessionID"
];
dataTable.TableName =
"Details"
;
dataTable.PrimaryKey = PrimaryKeys;
dataset.Tables.Add(dataTable);
string
strSql2 =
string
.Format(
"SELECT SessionID, TicketID, FaultCategory, Status, AssignedTo from appTicket where SessionID in (Select top 100 s.SessionID from appSession s inner join appCandidate ca on s.CandidateID=ca.CandidateID where (s.CompanyID={0:d} or {0:d}=-1) {1} order by s.Start desc)"
,nCompany, strWhere);
adapter.SelectCommand =
new
SqlCommand(strSql2, conn);
dataTable =
new
DataTable();
adapter.Fill(dataTable);
DataColumn[] ForeignKeys =
new
DataColumn[1];
ForeignKeys[0] = dataTable.Columns[
"SessionID"
];
dataTable.TableName =
"Detail"
;
dataset.Tables.Add(dataTable);
DataRelation SummaryDetail =
new
DataRelation(
"SummaryDetail"
, PrimaryKeys, ForeignKeys);
dataset.Relations.Add(SummaryDetail);
}
finally
{
conn.Close();
}
HelpdeskGrid.DataSource = dataset;
<MasterTableView HeirarchyLoadMode=
"client"
DataKeyNames=
"SessionID"
ClientDataKeyNames=
"SessionID"
>
<CommandItemSettings ExportToPdfText=
"Export to PDF"
></CommandItemSettings>
<RowIndicatorColumn Visible=
"True"
FilterControlAltText=
"Filter RowIndicator column"
>
<HeaderStyle Width=
"20px"
></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible=
"True"
FilterControlAltText=
"Filter ExpandColumn column"
>
<HeaderStyle Width=
"20px"
></HeaderStyle>
</ExpandCollapseColumn>
<EditFormSettings>
<EditColumn FilterControlAltText=
"Filter EditCommandColumn column"
>
</EditColumn>
</EditFormSettings>
<DetailTables >
<telerik:GridTableView HierarchyLoadMode=
"Client"
DataKeyNames=
"SessionID"
Name=
"TicketDetails"
>
<ParentTableRelation>
<telerik:GridRelationFields DetailKeyField=
"SessionID"
MasterKeyField=
"SessionID"
></telerik:GridRelationFields>
</ParentTableRelation>
<Columns>
<telerik:GridBoundColumn HeaderText=
"TicketID"
DataField=
"TicketID"
UniqueName=
"TicketID"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Category"
DataField=
"FaultCategory"
UniqueName=
"FaultCategoryName"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Assigned To"
DataField=
"AssignedTo"
UniqueName=
"AssignedTo"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Status"
DataField=
"Status"
UniqueName=
"StatusID"
>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText=
"Options"
UniqueName=
"Option"
DataField=
"SessionID"
>
<ItemTemplate>
<telerik:RadButton AutoPostBack=
"false"
runat=
"server"
Text=
"Open Ticket"
onclientclicked=
'onOpenTicket'
CommandArgument=
'<%# DataBinder.Eval( Container, "DataItem.TicketID") %>'
>
</telerik:RadButton>
</ItemTemplate>
<HeaderStyle Width=
"200px"
/>
<ItemStyle Width=
"200px"
/>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn HeaderText=
"Company"
DataField=
"Company"
UniqueName=
"company"
>
<HeaderStyle Width=
"200px"
/>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Campaign"
DataField=
"Campaign"
UniqueName=
"Campaign"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"First Name"
DataField=
"FirstName"
UniqueName=
"FirstName"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Last Name"
DataField=
"LastName"
UniqueName=
"LastName"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Email"
DataField=
"Email"
UniqueName=
"Email"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Start"
DataField=
"Start"
UniqueName=
"Start"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"Status"
DataField=
"Status"
UniqueName=
"Status"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText=
"SessionID"
Display=
"false"
DataField=
"SessionID"
UniqueName=
"SessionID"
>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText=
"Options"
UniqueName=
"Option"
DataField=
"SessionID"
>
<ItemTemplate>
<telerik:RadButton AutoPostBack=
"false"
ID=
"btn_createSession"
runat=
"server"
Text=
"New Ticket"
OnClientClicked=
"onCreateTicket"
CommandArgument=
'<%# DataBinder.Eval( Container, "DataItem.SessionID") %>'
>
</telerik:RadButton>
<telerik:RadButton AutoPostBack=
"false"
ID=
'Open'
runat=
"server"
Text=
"Open"
Value=
"TestValue"
CommandArgument=
'<%# DataBinder.Eval( Container, "DataItem.SessionID") %>'
OnClientClicked=
"onOpen"
>
</telerik:RadButton>
</ItemTemplate>
<HeaderStyle Width=
"200px"
/>
<ItemStyle Width=
"200px"
/>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<FilterMenu EnableImageSprites=
"False"
>
</FilterMenu>
</telerik:RadGrid>