when mouse click the "click here to select" then show menu let me to select user
how can i do this
thank you.
how can i do this
thank you.
WebOrdersAppointGridView.MasterTemplate.AutoGenerateColumns =
true
;
WebOrdersAppointGridView.ShowGroupPanel =
true
;
WebOrdersAppointGridView.MasterTemplate.AllowEditRow =
true
;
WebOrdersAppointGridView.MasterTemplate.AutoExpandGroups =
true
;
WebOrdersAppointGridView.MasterTemplate.EnableFiltering =
true
;
WebOrdersAppointGridView.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
WebOrdersAppointGridView.MasterTemplate.EnableGrouping =
true
;
WebOrdersAppointGridView.MasterTemplate.AllowAddNewRow =
false
;
WebOrdersAppointGridView.MasterTemplate.AllowDragToGroup =
true
;
WebOrdersListGridView.TableElement.BeginUpdate();
WebOrdersAppointGridView.Rows.Clear();
// start read data
using
(MySqlDataReader dr = MySQLHelper.ExecuteReader(MySQLHelper.DBConnectionString, CommandType.Text, sqlText,
null
)) {
if
(!dr.HasRows) {
WebOrdersAppointGridView.TableElement.Text =
"no data to display"
;
return
;
}
else
{
WebOrdersAppointGridView.MasterTemplate.LoadFrom(dr);
}
}
WebOrdersAppointGridView.Columns[
"contact_id"
].HeaderText =
"NO."
;
WebOrdersAppointGridView.Columns[
"contact_id"
].TextAlignment = ContentAlignment.MiddleCenter;
WebOrdersAppointGridView.Columns[
"contact_id"
].Width = 70;
WebOrdersAppointGridView.Columns[
"username"
].HeaderText =
"姓名"
;
WebOrdersAppointGridView.Columns[
"username"
].Width = 150;
WebOrdersAppointGridView.Columns[
"telephone"
].HeaderText =
"联系电话"
;
WebOrdersAppointGridView.Columns[
"telephone"
].Width = 150;
WebOrdersAppointGridView.Columns[
"qq"
].HeaderText =
"联系QQ"
;
WebOrdersAppointGridView.Columns[
"qq"
].Width = 150;
WebOrdersAppointGridView.Columns[
"area_id"
].HeaderText =
"所在区域"
;
WebOrdersAppointGridView.Columns[
"area_id"
].DataType =
typeof
(
string
);
WebOrdersAppointGridView.Columns[
"area_id"
].Width = 150;
WebOrdersAppointGridView.Columns[
"address"
].HeaderText =
"所在地址"
;
WebOrdersAppointGridView.Columns[
"address"
].Width = 150;
WebOrdersAppointGridView.Columns[
"addtime"
].HeaderText =
"递交时间"
;
WebOrdersAppointGridView.Columns[
"addtime"
].TextAlignment = ContentAlignment.MiddleCenter;
WebOrdersAppointGridView.Columns[
"addtime"
].DataType =
typeof
(
string
);
WebOrdersAppointGridView.Columns[
"addtime"
].Width = 150;
WebOrdersListGridView.TableElement.EndUpdate();
8 Answers, 1 is accepted
0
Asfz
Top achievements
Rank 1
answered on 06 Jan 2013, 04:48 AM
like this image
0
konrad
Top achievements
Rank 1
answered on 06 Jan 2013, 12:44 PM
0
Asfz
Top achievements
Rank 1
answered on 08 Jan 2013, 06:16 AM
I failed.
i have a error "A column with the same Name already exists in the collection"
Can you give me a sample code pack?
use pageview and gridview.
Thanks
i have a error "A column with the same Name already exists in the collection"
Can you give me a sample code pack?
use pageview and gridview.
Thanks
0
Hi guys,
Thank you for writing.
Asfz, if I understand correctly, you just want to add a combo box column to your grid, so your users can select from multiple options. If so, please consider the following documentation article: http://www.telerik.com/help/winforms/gridview-columns-gridviewcomboboxcolumn.html. In case you need mutli selection, take a look at the KB article that Dominik provided.
The error "A column with the same Name already exists in the collection" is thrown when you attempt to add a column to the grid which already exists.
I hope you find my information useful.
Greetings,
Plamen
the Telerik team
Thank you for writing.
Asfz, if I understand correctly, you just want to add a combo box column to your grid, so your users can select from multiple options. If so, please consider the following documentation article: http://www.telerik.com/help/winforms/gridview-columns-gridviewcomboboxcolumn.html. In case you need mutli selection, take a look at the KB article that Dominik provided.
The error "A column with the same Name already exists in the collection" is thrown when you attempt to add a column to the grid which already exists.
I hope you find my information useful.
Greetings,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Asfz
Top achievements
Rank 1
answered on 14 Jan 2013, 08:55 AM
GridViewCommandColumn commandColumn =
new
GridViewCommandColumn(
"users"
);
commandColumn.UseDefaultText =
true
;
commandColumn.DefaultText =
"指派"
;
commandColumn.Width = 80;
commandColumn.Name =
"UserColumn"
;
commandColumn.TextAlignment = ContentAlignment.MiddleCenter;
WebOrdersAppointGridView.MasterTemplate.Columns.Add(commandColumn);
A column with the same Name already exists in the collection
Thanks
0
Hi Asfz,
Thank you for writing.
I assume, that you attempt to add a column to the grid which already exists. I have tested the provided code and everything is working as expected on my end. Here is a sample implementation of two columns with the same header text but different column names:
I also noticed that you are using GridViewCommandColumn, so I want to navigate you to our documentation article, which I hope you will find useful: http://www.telerik.com/help/winforms/gridview-columns-gridviewcommandcolumn.html.
If you have any further questions, I will be glad to help.
Kind regards,
Plamen
the Telerik team
Thank you for writing.
I assume, that you attempt to add a column to the grid which already exists. I have tested the provided code and everything is working as expected on my end. Here is a sample implementation of two columns with the same header text but different column names:
GridViewCommandColumn commandColumn =
new
GridViewCommandColumn();
commandColumn.Name =
"CommandColumn"
;
commandColumn.UseDefaultText =
false
;
commandColumn.FieldName =
"ProductName"
;
commandColumn.HeaderText =
"Order"
;
radGridView1.MasterTemplate.Columns.Add(commandColumn);
GridViewCommandColumn commandColumn2 =
new
GridViewCommandColumn();
commandColumn2.Name =
"CommandColumn2"
;
commandColumn2.UseDefaultText =
true
;
commandColumn2.DefaultText =
"Order"
;
commandColumn2.FieldName =
"ProductName"
;
commandColumn2.HeaderText =
"Order"
;
radGridView1.MasterTemplate.Columns.Add(commandColumn2);
I also noticed that you are using GridViewCommandColumn, so I want to navigate you to our documentation article, which I hope you will find useful: http://www.telerik.com/help/winforms/gridview-columns-gridviewcommandcolumn.html.
If you have any further questions, I will be glad to help.
Kind regards,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Asfz
Top achievements
Rank 1
answered on 15 Jan 2013, 08:43 AM
thanks to reply,i mean is i have use gridview in pageview ,when i first click pageview all is good,but when i second click pageview an error occurred "A column with the same Name already exists in the collection"
how to fix this error?
how to fix this error?
WebOrdersAppointGridView
.TableElement.BeginUpdate();
WebOrdersAppointGridView.Rows.Clear();
WebOrdersAppointGridView.Columns [
"contact_id"
].HeaderText =
"NO."
;
WebOrdersAppointGridView.Columns [
"contact_id"
].TextAlignment = ContentAlignment.MiddleCenter;
WebOrdersAppointGridView.Columns [
"contact_id"
].Width = 70;
WebOrdersAppointGridView.Columns [
"username"
].HeaderText =
"Username"
;
WebOrdersAppointGridView.Columns [
"username"
].Width = 150;
GridViewCommandColumn commandColumn =
new
GridViewCommandColumn(
"Users"
);
if
(commandColumn ==
null
) {
// i have add this code ,but nothing will be add to gridview????
commandColumn.UseDefaultText =
true
;
commandColumn.DefaultText =
"Please select user"
;
commandColumn.Width = 60;
commandColumn.TextAlignment = ContentAlignment.MiddleCenter;
WebOrdersAppointGridView.Columns.Add(commandColumn);
}
WebOrdersAppointGridView
.TableElement.EndUpdate();
0
Hi Asfz,
Thank you for writing.
As to the error "A column with the same Name already exists in the collection", as I already mentioned, you probably attempt to add a column to the grid which already exists. Make sure that the column with the same name does not exist prior attempting to add a new one. If you cannot resolve this case, please open a new support ticket and provide us with your application there.
This code does not work, because you first create an instance of a GridViewCommandColumn and after that you are trying to check if such object exist:
Here are some suggestions when using RadGridView:
Greetings,
Plamen
the Telerik team
Thank you for writing.
As to the error "A column with the same Name already exists in the collection", as I already mentioned, you probably attempt to add a column to the grid which already exists. Make sure that the column with the same name does not exist prior attempting to add a new one. If you cannot resolve this case, please open a new support ticket and provide us with your application there.
This code does not work, because you first create an instance of a GridViewCommandColumn and after that you are trying to check if such object exist:
GridViewCommandColumn commandColumn =
new
GridViewCommandColumn(
"Users"
);
if
(commandColumn ==
null
)
{
// ...
}
Here are some suggestions when using RadGridView:
- When assigning values to several cells subsequently, RadGridView should be placed between BeginUpdate() and EndUpdate() method invocations of the desired template. This way of setting multiple assignments is recommended for performance considerations.
- Regarding the Rows.Clear method, it does not work when bound to a DataTable, is used in unbound mode.
Attached you can find a sample project where my suggestions were implemented.
I hope you find my information useful. If you have any additional questions, I will be glad to assist you.Greetings,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.