Thanks Mr. Mike.
However I worked it out in the following way. Please suggest me whether it is correct or not? If there is any best way please mention with the sample code [I think you will understand my requirement by seeing the below code. Most important thing to remember is that I'm getting the data source from the business logic layer instead of direct access to datasets].
I found another problem with the column "EntryTime". There I need to display the time or both date and time of entry instead of onlf date.But the grid displays only date. How can I format the column so that it displays Date and Time or only Time?
*********************************************************************************************************************
private void FillTodaysQueue()
{
QueueMaster queueMaster = new QueueMaster();
if (!ugQueue.DisplayLayout.Bands[0].Columns.Contains("ElapsedTime"))
{
ugQueue.DisplayLayout.Bands[0].Columns.Add("ElapsedTime", "Elapsed Time");
}
ugQueue.DataSource = queueMaster.GetTodayQueue();
ugQueue.Refresh();
ugQueue.DisplayLayout.Bands[0].Columns["Sno"].Width = 30;
// Hide unneccessary columns
ugQueue.DisplayLayout.Bands[0].Columns["QueueId"].Hidden = true;
ugQueue.DisplayLayout.Bands[0].Columns["PatientId"].Hidden = true;
ugQueue.DisplayLayout.Bands[0].Columns["ConsultantId"].Hidden = true;
ugQueue.DisplayLayout.Bands[0].Columns["ExitTime"].Hidden = true;
ugQueue.DisplayLayout.Bands[0].Columns["EntryTime"].Header.Caption = "Entry Time";
// Hide filter icon on unneccessary columns
//ugQueue.DisplayLayout.Bands[0].Columns["ElapsedTime"].AllowRowFiltering = DefaultableBoolean.False;
ugQueue.DisplayLayout.Bands[0].Columns["Sno"].AllowRowFiltering = DefaultableBoolean.False;
ugQueue.DisplayLayout.Bands[0].Columns["PatientId"].AllowRowFiltering = DefaultableBoolean.False;
ugQueue.DisplayLayout.Bands[0].Columns["EntryTime"].AllowRowFiltering = DefaultableBoolean.False;
//ugQueue.DisplayLayout.Bands[0].Columns["ConsultantId"].Width = 150;
//ugQueue.DisplayLayout.Bands[0].Columns["EntryTime"].Width = 125;
//ugQueue.DisplayLayout.Bands[0].Columns["ElapsedTime"].Width = 100;
//ugQueue.DisplayLayout.Bands[0].Columns["ElapsedTime"].Swap(ugQueue.DisplayLayout.Bands[0].Columns["Status"]);
FillValueLists();
queueMaster.Dispose();
}
/// <summary>
/// Displays Consultant Name instead of ConsultantId,
/// Patient name instead of Patient Id, etc…
/// </summary>
private void FillValueLists()
{
ugQueue.DisplayLayout.ValueLists.Add("PatientType");
ugQueue.DisplayLayout.ValueLists["PatientType"].ValueListItems.Add(0, "New");
ugQueue.DisplayLayout.ValueLists["PatientType"].ValueListItems.Add(1, "Old");
ugQueue.DisplayLayout.ValueLists["PatientType"].ValueListItems.Add(2, "Renew");
ugQueue.DisplayLayout.ValueLists["PatientType"].DisplayStyle = ValueListDisplayStyle.DisplayText;
ugQueue.DisplayLayout.Bands[0].Columns["PType"].ValueList = ugQueue.DisplayLayout.ValueLists["PatientType"];
ugQueue.DisplayLayout.ValueLists.Add("QueueType");
ugQueue.DisplayLayout.ValueLists["QueueType"].ValueListItems.Add(0, "Appointment");
ugQueue.DisplayLayout.ValueLists["QueueType"].ValueListItems.Add(1, "General");
ugQueue.DisplayLayout.ValueLists["QueueType"].ValueListItems.Add(2, "");
ugQueue.DisplayLayout.ValueLists["QueueType"].DisplayStyle = ValueListDisplayStyle.DisplayText;
ugQueue.DisplayLayout.Bands[0].Columns["QType"].ValueList = ugQueue.DisplayLayout.ValueLists["QueueType"];
ugQueue.DisplayLayout.ValueLists.Add("Status");
ugQueue.DisplayLayout.ValueLists["Status"].ValueListItems.Add(0, "Pending");
ugQueue.DisplayLayout.ValueLists["Status"].ValueListItems.Add(1, "");
ugQueue.DisplayLayout.ValueLists["Status"].DisplayStyle = ValueListDisplayStyle.DisplayText;
ugQueue.DisplayLayout.Bands[0].Columns["Status"].ValueList = ugQueue.DisplayLayout.ValueLists["Status"];
}