| function isPartOfSchedulerAppointmentArea(htmlElement) |
| { |
| // Determines if an html element is part of the scheduler appointment area |
| // This can be either the rsContent or the rsAllDay div (in day and week view) |
| var scheduler = $find('<%= RadScheduler1.ClientID %>'); |
| var allDayDiv = $telerik.getChildByClassName(scheduler.get_element(), "rsAllDay"); |
| var contentDiv = $telerik.getChildByClassName(scheduler.get_element(), "rsContent"); |
| return $telerik.isDescendant(contentDiv, htmlElement) || $telerik.isDescendant(allDayDiv, htmlElement); |
| } |
Could I do it in the Button_Click by just changing the row in the grid by modifying the selected rows that are held in View State? If so, HELP please.
This is my Code behind from the Grid
| protected void ButtonAssign_Click(object sender, EventArgs e) |
| { |
| foreach (GridDataItem item in RadGrid1.MasterTableView.Items) |
| { |
| CheckBox chkbx = (CheckBox)item["ClientSelectColumn"].Controls[0]; |
| if (chkbx.Checked) |
| { |
| ProductBLL myData = new ProductBLL(); |
| string productId = item["ID"].Text.ToString(); |
| string user = Convert.ToString(DropDownListUserNew.SelectedValue); |
| myData.ProductId = Convert.ToInt32(productId ); |
| myData.User = user ; |
| myData.UpdateUser(); |
| I would like to update the ViewState so the RadGrid Column and Row have the new user |
| } |
| } |
| } |
Thank you!
//Define RadtabStrip
RadTabStrip.ID =
"RadTabStrip";
RadTabStrip.BorderColor =
Color.Black;
RadTabStrip.Width =
Unit.Pixel(930);
RadTabStrip.Height =
Unit.Pixel(500);
RadTabStrip.Orientation =
TabStripOrientation.VerticalLeft;
RadTabStrip.MultiPageID =
"RadMultiPageID";
RadTabStrip.Tabs.Add(AddRadTab(
"Warnings", "WarningspageView"));
RadTabStrip.Tabs.Add(AddRadTab(
"History", "HistoryPageView"));
RadTabStrip.Tabs.Add(AddRadTab(
"Watches", "WatchPageView"));
RadTabStrip.Tabs.Add(AddRadTab(
"Destination", "DestinationPageView"));
RadTabStrip.Tabs.Add(AddRadTab(
"Properties", "PropertiesPageView"));
RadMultiPage RadMultiPageID = new RadMultiPage();
RadMultiPageID.ID =
"RadMultiPageID";
RadPageView RPageView = PageView("WatchPageView");
LabelWatchName.ID =
"LabelWatchName";
LabelWatchName.Text =
"Watch Name: ";
TextBoxWatchName.ID =
"TextBoxWatchName";
TextBoxWatchName.Width =
Unit.Pixel(900);
HtmlGenericControl div = CreateDiv("watchnamedic");
div.Controls.Add(LabelWatchName);
div.Controls.Add(TextBoxWatchName);
//RPageView.Controls.Add(div);
LabelDisplayName.ID =
"LabelDisplayName";
LabelDisplayName.Text =
"Display Name: ";
TextBoxDisplayName.ID =
"TextBoxDisplayName";
TextBoxDisplayName.Width =
Unit.Pixel(500);
div = CreateDiv(
"displaynamedic");
div.Controls.Add(LabelDisplayName);
div.Controls.Add(TextBoxDisplayName);
RPageView.Controls.Add(div);
RadMultiPageID.PageViews.Add(LabelDisplayName);
Controls.Add(RadTabStrip);
}
catch (Exception e) { }
}
private RadPageView PageView(string name)
{
RadPageView radpageview = new RadPageView();
radpageview.ID =
"radpageview";
return radpageview;
}
private HtmlGenericControl CreateDiv(string divname)
{
HtmlGenericControl div = new HtmlGenericControl("div");
div.ID = divname;
return div;
}
private RadTab AddRadTab(string CurrentTabName, string PageviewID)
{
RadTab RadTab = new RadTab();
RadTab.Text = CurrentTabName;
RadTab.PageViewID = PageviewID;
return RadTab;
}
Hi,
We are trying to create a grid dynamically from an untyped dataset (we don't know the amount of columns in it). Basically it should be a grid that renders in edit-mode (in-place) so that it contains drop-down selections for each row/column.
We bind the grid to a datasource (ObjectDataSource1) that fills is with all selected values for each column and row, and then in the ItemDatabound we try to hook additional datasources for the dropdowns so that they contain the additional selectable values.
Now, the grid seems to render correctly and each dropdown have the correct values to select from, but the default selections in the dropdowns doesn't match the values in the original datasource. We want those two to "bind" so to speak. What's the missing peace?
Here's the aspx-code:
| <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="ObjectDataSource1" |
| GridLines="None" Skin="Vista" AutoGenerateColumns="False" OnPreRender="RadGrid1_PreRender" AllowMultiRowEdit="True" OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowSelection="True" OnCreateColumnEditor="RadGrid1_CreateColumnEditor"> |
| <MasterTableView DataSourceID="ObjectDataSource1" EditMode="InPlace" Name="Master"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| </telerik:RadGrid> <br /> |
| <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" |
| SelectMethod="SelectByVersionId" TypeName="Insera.Application.Web.CorrectRent.Business.AreaValuationGrid" EnableCaching="True"> |
| <SelectParameters> |
| <asp:ProfileParameter Name="VersionId" PropertyName="CompanyVersionId" Type="Object" /> |
| </SelectParameters> |
| </asp:ObjectDataSource> |
| DataView dv = (DataView)ObjectDataSource1.Select(); |
| DataSet ds = dv.Table.DataSet.Copy(); |
| // Loop rows in main dataset and add dropdowncolumns |
| foreach (DataRow row in ds.Tables[1].Rows) |
| { |
| Guid parameterId = new Guid(row[0].ToString()); |
| string parameterDescription = row[1].ToString(); |
| GridDropDownColumn dropDownColumn = new GridDropDownColumn(); |
| this.RadGrid1.MasterTableView.Columns.Add(dropDownColumn); |
| dropDownColumn.UniqueName = parameterId.ToString(); |
| dropDownColumn.HeaderText = parameterDescription; |
| dropDownColumn.ListTextField = "Description"; |
| dropDownColumn.ListValueField = "FactorId"; |
| dropDownColumn.DataField = parameterId.ToString(); |
| dropDownColumn.DropDownControlType = GridDropDownColumnControlType.RadComboBox; |
| } |
| protected void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| foreach (GridItem item in RadGrid1.MasterTableView.Items) |
| { |
| if (item is GridEditableItem) |
| { |
| GridEditableItem editableItem = item as GridDataItem; |
| editableItem.Edit = true; |
| } |
| } |
| RadGrid1.Rebind(); |
| } |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) |
| { |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| GridEditManager editMan = editedItem.EditManager; |
| foreach (GridColumn gridColumn in this.RadGrid1.MasterTableView.Columns) |
| { |
| if (gridColumn is GridDropDownColumn) |
| { |
| GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor(gridColumn.UniqueName)); |
| editor.DataTextField = "Description"; |
| editor.DataValueField = "FactorId"; |
| ObjectDataSource factorObjectDataSource; |
| if (factorDataSources.ContainsKey(gridColumn.UniqueName)) |
| { |
| factorObjectDataSource = factorDataSources[gridColumn.UniqueName] as ObjectDataSource; |
| } |
| else |
| { |
| factorObjectDataSource = new ObjectDataSource(); |
| factorObjectDataSource.TypeName = "Insera.Application.Web.CorrectRent.Business.Factor"; |
| factorObjectDataSource.SelectMethod = "SelectByParameterId"; |
| factorObjectDataSource.SelectParameters.Add(new System.Web.UI.WebControls.Parameter("ParameterId", TypeCode.Object, gridColumn.UniqueName)); |
| factorObjectDataSource.EnableCaching = true; |
| factorObjectDataSource.ID = gridColumn.UniqueName; |
| factorDataSources.Add(gridColumn.UniqueName, factorObjectDataSource); |
| } |
| editor.DataSource = factorObjectDataSource; |
| editor.DataBind(); |
| } |
| } |
| } |
| } |