Hi,
I'm unable to mimic Master - Detail data display using RadGridView control. Let me know where I'm going wrong.
Following is my code:
private void BindGrid()
{
try
{
DataTable dtDept = new DataTable();
DataColumn dcDptID = new DataColumn("DeptID");
DataColumn dcDName = new DataColumn("DeptName");
dtDept.Columns.Add(dcDptID);
dtDept.Columns.Add(dcDName);
DataRow drDPT = dtDept.NewRow();
drDPT["DeptID"] = "10";
drDPT["DeptName"] = "Admin";
dtDept.Rows.Add(drDPT);
drDPT = dtDept.NewRow();
drDPT["DeptID"] = "11";
drDPT["DeptName"] = "Finance";
dtDept.Rows.Add(drDPT);
DataTable dtEmp = new DataTable();
DataColumn dcID = new DataColumn("EmpID");
DataColumn dcName = new DataColumn("EmpName");
DataColumn dcDeptID = new DataColumn("DeptID");
dtEmp.Columns.Add(dcID);
dtEmp.Columns.Add(dcName);
dtEmp.Columns.Add(dcDeptID);
DataRow dRow = dtEmp.NewRow();
dRow["EmpID"] = "1001";
dRow["EmpName"] = "Raaz";
dRow["DeptID"] = "10";
dtEmp.Rows.Add(dRow);
dRow = dtEmp.NewRow();
dRow["EmpID"] = "1002";
dRow["EmpName"] = "Amit";
dRow["DeptID"] = "11";
dtEmp.Rows.Add(dRow);
rdGridDemo.MasterTemplate.DataSource = dtDept ;
GridViewTemplate gvChildTemplate = new GridViewTemplate();
gvChildTemplate.AutoGenerateColumns = false;
gvChildTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
gvChildTemplate.AllowAddNewRow = false;
gvChildTemplate.EnableCustomGrouping = false;
gvChildTemplate.EnableGrouping = false;
gvChildTemplate.ShowGroupedColumns = false;
GridViewTextBoxColumn colEmpID = new GridViewTextBoxColumn();
colEmpID.Name = "colEmpID";
colEmpID.HeaderText = "Employee ID";
colEmpID.FieldName = "EmpID";
gvChildTemplate.Columns.Add(colEmpID);
GridViewTextBoxColumn colEmpName = new GridViewTextBoxColumn();
colEmpName.HeaderText = "Employee Name";
colEmpName.FieldName = "EmpName";
gvChildTemplate.Columns.Add(colEmpName);
GridViewTextBoxColumn colDeptID = new GridViewTextBoxColumn();
colDeptID.HeaderText = "Dept ID";
colDeptID.FieldName = "Dept ID";
gvChildTemplate.Columns.Add(colDeptID);
gvChildTemplate.DataSource = dtEmp;
rdGridDemo.Templates.Clear();
rdGridDemo.Relations.Clear();
rdGridDemo.MasterTemplate.Templates.Add(gvChildTemplate);
GridViewRelation relation = new GridViewRelation(rdGridDemo.MasterTemplate);
relation.ChildTemplate = gvChildTemplate;
relation.RelationName = "EmpDeptRelation";
relation.ParentColumnNames.Add("DeptID");
relation.ChildColumnNames.Add("DeptID");
rdGridDemo.Relations.Add(relation);
}
catch (Exception Ex)
{
lblMsg.Text = Ex.Message;
}
}
/* Thanks */
using
System;
using
System.Linq;
using
System.Windows.Forms;
using
PlantManager.Classes;
namespace
PlantManager.Admin.UserManager
{
public
partial
class
frmUserManager : Form
{
public
frmUserManager()
{
InitializeComponent();
}
private
void
frmUserManager_Load(
object
sender, EventArgs e)
{
LoadData();
}
private
void
LoadData()
{
QueryAgent qry =
new
QueryAgent();
qry.SQLText =
"SELECT tbl_Users.UserID,tbl_Users.Username,tbl_Users.FirstName,tbl_Users.LastName,tbl_Users.PhoneExt,tbl_Users.EmailAddress FROM dbo.tbl_Users WHERE tbl_Users.Active = 1"
;
qry.exec_SelectQuery();
dgResults.DataSource = qry.DataSource;
}
private
void
mnuEditUser_Click(
object
sender, EventArgs e)
{
EditUser();
}
private
void
dgResults_DoubleClick(
object
sender, EventArgs e)
{
EditUser();
}
private
void
EditUser()
{
string
UserID = dgResults.CurrentRow.Cells[
"UserID"
].Value.ToString();
PubVar.OpenForm(
"Admin.UserManager.frmEditUser"
,
new
string
[1] { UserID },
this
,
true
);
this
.Dispose();
}
}
}
How do I get the index of a ListView item when the user right clicks on it?
Note: I do not want to set the SelectedItem of the ListView and get SelectedIndex.
Thank you,
Mohammad
Hello,
How can I remove the border around the quick access buttons. This border appears with the Telerik Metro theme. Interestingly, when the Quick Access buttons are placed below the ribbon the border does not appear.
Thanks,
Robert
I'm test out the Scheduler. I'm trying to cancel moving a appointment if it new date is past todays date. In the AppointmnetDropped, i figured i should check and cancel here. I cannot find a cancel function to set. I did find in other posts you used a "e.Cancel = true" e is AppointmentMovingEventArgs. But can not see a Cancel in the AppointmentMovingEventArgs.
Did this way change?
I'm using VB.net 2015.
Lawrence
I'm using version 2017.2.613.40 of RadDock.
I'm using RadDock to host custom user controls by calling:
radDock.DockControl(_HostedControl, DefaultDockPosition, DockType.Document);
This creates a HostWindow. It works great, however some of my user controls have somewhat expensive paint events. For example, one is a chart which could have tens of thousands of data points and it can take a second or two to repaint the control. Obviously, I'd like for this paint to be instant, but it's not. It's what I'm stuck with for now.
My issue is when I try to rearrange DockWindows by dragging them to a different position in the RadDock and docking them there. The dragging triggers repaints in the user control. And the user control tries to repaint while it's being dragged. This ends up stalling everything for a couple seconds several times during the drag. This makes it not just annoying, but almost impossible to move DockWindows around which is one of the main reasons, of course, to use a RadDock in the first place.
My question is this: what are the best RadDock or DockWindow events to subscribe to in order to disable my control when the drag starts and then to re-enable it after it gets re-docked at a new location in the RadDock.
Since these are custom controls, I have the ability to turn off painting or hide the control completely, I just need the right hooks to be able to do this at the right times.
Thanks,
Steve
Hi,
I want to use WinForms RadDigram as platform for a gui Editor.
is it possible to add a "normal" control object like button or even an RadChart as RadDiagramShape ?
BTW: ist WinForms a right choys for future prooft Projects
Besdt Regards
Paul
Hello,
I just started to figure out how to use the Telerik 2016.3.1024.40 components with OpenEdge 11.7.1.
Using the RadGridView and BindingSource components I am unable to show the records of one of the tables in my database.
I connected the BindingSource to the table (for example "SomeTable") of my choice and set the RadGridView.DataSource property to the BindingSource. During design-time I see the correct fields of the table, but no records. With the PropertyBuilder the order of the columns can be changed which is also visible in the grid. So far so good.
When I run the application an empty record is shown and when I try to add a new record or edit the contents of the empty record, the message "BindingSource is not bound to a DataSource" is shown.
Do I miss some code to load the records in the grid?
When I connect the grid to another BindingSource that is not connected to a table in my database, the following code can be used to display the contents of the table (just to demonstrate that the grid is able to display at least something):
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE hdsSomeTable AS HANDLE NO-UNDO.
DEFINE DATASET dsSomeTable FOR ttSomeTable.
FOR EACH SomeTable NO-LOCK:
CREATE ttSomeTable.
BUFFER-COPY SomeTable TO ttSomeTable.
END.
hdsSomeTable = DATASET dsSomeTable:HANDLE.
hQuery = hdsSomeTable:TOP-NAV-QUERY.
hQuery:QUERY-OPEN().
bindingSource1:HANDLE = hQuery.
Please advise,
Bert