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

Ajax, DropDown with checkbox

5 Answers 186 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcia Marino
Top achievements
Rank 1
Marcia Marino asked on 06 Feb 2008, 04:24 AM

I'm creating a dinamic grid but having proble adding Ajax to it, also I need to be able to have multi select field so I was thinking about DropDown with checkbox.
I add the HTMLColumn bud it didn't work neither.

here it is.

private

void DefineGridStructure()

{

 

RadGrid1.ID =

"RadGrid1";

RadGrid1.Width =

Unit.Percentage(98);

RadGrid1.AllowPaging =

true;

RadGrid1.AllowSorting =

true;

RadGrid1.PagerStyle.Mode =

GridPagerMode.NumericPages;

RadGrid1.AutoGenerateColumns =

false;

//RadGrid1.EnableAJAX = true;

RadGrid1.GridLines =

GridLines.None;

RadGrid1.ShowStatusBar =

true;

RadGrid1.AllowAutomaticDeletes =

true;

RadGrid1.AllowAutomaticInserts =

true;

RadGrid1.AllowAutomaticUpdates =

true;

GridEditCommandColumn editcommandColumn;

editcommandColumn =

new GridEditCommandColumn();

RadGrid1.MasterTableView.Columns.Add(editcommandColumn);

editcommandColumn.UniqueName =

"ThiseditcommandColumn";

editcommandColumn.ButtonType =

GridButtonColumnType.ImageButton;

editcommandColumn.EditImageUrl =

"~/Images/grid/edit.gif";

editcommandColumn.HeaderText = edit;

RadGrid1.MasterTableView.DataKeyNames =

new string[] {"LibraryID", "PortalID"};

RadGrid1.MasterTableView.AutoGenerateColumns =

false;

RadGrid1.PageIndexChanged +=

new Telerik.Web.UI.GridPageChangedEventHandler(this.RadGrid1_PageIndexChanged);

RadGrid1.NeedDataSource +=

new Telerik.Web.UI.GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource);

RadGrid1.PreRender +=

new System.EventHandler(this.RadGrid1_PreRender);

RadGrid1.ItemDataBound +=

new Telerik.Web.UI.GridItemEventHandler(this.RadGrid1_ItemDataBound);

RadGrid1.UpdateCommand +=

new GridCommandEventHandler(this.RadGrid1_UpdateCommand);

RadGrid1.InsertCommand +=

new GridCommandEventHandler(this.RadGrid1_InsertCommand);

RadGrid1.DeleteCommand +=

new GridCommandEventHandler(this.RadGrid1_DeleteCommand);

RadGrid1.MasterTableView.CommandItemDisplay =

GridCommandItemDisplay.Top;

//RadGrid1.MasterTableView.EditFormSettings.UserControlName = "~/BackOffice/Groups/Group.ascx";

RadGrid1.MasterTableView.EditFormSettings.EditFormType =

GridEditFormType.AutoGenerated;

RadGrid1.MasterTableView.EditFormSettings.EditColumn.UniqueName =

"EditCommandColumn1";

RadGrid1.MasterTableView.ExpandCollapseColumn.ButtonType =

GridExpandColumnType.ImageButton;

RadGrid1.MasterTableView.ExpandCollapseColumn.UniqueName =

"ExpandColumn";

RadGrid1.MasterTableView.ExpandCollapseColumn.Visible =

false;

 

GridButtonColumn buttoncolumn;

//buttoncolumn = new GridButtonColumn();

//buttoncolumn.UniqueName = "Image1";

//buttoncolumn.ButtonType = GridButtonColumnType.ImageButton;

//buttoncolumn.CommandName = "Select";

//RadGrid1.MasterTableView.Columns.Add(buttoncolumn);

string veditColumnName = "GroupID";

string vcArg = "";

int vcount = -1;

string vtype = "Image";

GridTemplateColumn veditColumn = new GridTemplateColumn();

veditColumn.ItemTemplate =

new editTemplate(veditColumnName, vcArg, vcount, vtype);

RadGrid1.MasterTableView.Columns.Add(veditColumn);

 

GridBoundColumn boundColumn;

boundColumn =

new GridBoundColumn();

boundColumn.DataField =

"Title";

boundColumn.HeaderText = title;

boundColumn.SortExpression =

"Title";

boundColumn.UniqueName =

"Title";

RadGrid1.MasterTableView.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

boundColumn.DataField =

"Description";

boundColumn.HeaderText = description;

boundColumn.SortExpression =

"Description";

boundColumn.UniqueName =

"Description";

boundColumn.MaxLength = 500;

RadGrid1.MasterTableView.Columns.Add(boundColumn);

GridDropDownColumn boundDropDown;

boundDropDown =

new GridDropDownColumn();

boundDropDown.DataField =

"Audiency";

boundDropDown.HeaderText = audiency;

boundDropDown.SortExpression =

"Audiency";

boundDropDown.UniqueName =

"Audiency";

RadGrid1.MasterTableView.Columns.Add(boundDropDown);

boundColumn =

new GridBoundColumn();

boundColumn.DataField =

"CreatedDt";

boundColumn.HeaderText = createddt;

boundColumn.SortExpression =

"CreatedDt";

boundColumn.UniqueName =

"CreatedDt";

RadGrid1.MasterTableView.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

boundColumn.DataField =

"UpdatedDt";

boundColumn.HeaderText = updateddt;

boundColumn.SortExpression =

"UpdatedDt";

boundColumn.UniqueName =

"UpdatedDt";

RadGrid1.MasterTableView.Columns.Add(boundColumn);

 

buttoncolumn =

new GridButtonColumn();

buttoncolumn.HeaderText = delete;

buttoncolumn.Text = delete;

buttoncolumn.ConfirmText = strconfirmdelete;

buttoncolumn.ButtonType =

GridButtonColumnType.ImageButton;

buttoncolumn.ImageUrl =

"~/Images/grid/delete.gif";

buttoncolumn.CommandName =

"Delete";

RadGrid1.MasterTableView.Columns.Add(buttoncolumn);

//Add the RadGrid instance to the controls

this.PlaceHolder1.Controls.Add(RadGrid1);

}

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 07 Feb 2008, 08:36 AM
Hello Marcia Marino,

The Prometheus controls, no longer have built-in ajax and in order to ajaxify them you should use either our RadAjax control or the MS AJAX framework.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Marcia Marino
Top achievements
Rank 1
answered on 15 Feb 2008, 06:14 AM
How do I add dropdown with checkbox, for multiple selection.

How can I change the "Add New Item" and "Refresh" text at run time.

thanks
0
Sebastian
Telerik team
answered on 15 Feb 2008, 09:33 AM
Hi Marcia,

Unfortunately dropdown with multi checkbox selection is not supported. Your alternative is to us built-in GridDropDownColumn with RadComboBox editor and its features:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/GeneralFeatures/ColumnTypes/DefaultCS.aspx

How to change the text of the [Add new record]/[Refresh] buttons text at runtime you can find from the help article pointed below:

http://www.telerik.com/help/radcontrols/prometheus/?grdCommandItemTemplate.html (paragraph Setting preferences for controls inside the CommandItemTemplate at runtime)

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Marcia Marino
Top achievements
Rank 1
answered on 16 Feb 2008, 11:51 PM
Great thanks, how do I ride column like I have Create and Update field that should not be edit by the user so I need to make that invisible on a add and edit mode
0
Sebastian
Telerik team
answered on 18 Feb 2008, 09:56 AM
Hello Marcia,

If you want to make a column not editable, simply set its ReadOnly property to true. Further information about the Display/Visible/ReadOnly properties of grid column you can find here:

http://www.telerik.com/help/radcontrols/prometheus/?grdUsingColumns.html (paragraph Accessing values in columns)

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Marcia Marino
Top achievements
Rank 1
Answers by
Steve
Telerik team
Marcia Marino
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or