or
| TableCell currentCell = new TableCell(); |
| RadCalendarDay day = new RadCalendarDay(RadCalendar1); |
| MonthView view = new MonthView(RadCalendar1); |
| Telerik.Web.UI.Calendar.DayRenderEventArgs e = new Telerik.Web.UI.Calendar.DayRenderEventArgs(currentCell, day,view); |
| DateTime CurrentDate = RadCalendar1.SelectedDate; |
| backgroundColor1 = Color.Red.Name; |
| backgroundColor = Color.Green.Name; |
| currentCell = e.Cell; |
| currentCell.Style["background-color"] = backgroundColor; |
| string Connection = "Data Source=62.197.41.101; Initial Catalog=PilotWebApp; User ID=sa; Pwd=medularis;"; |
| SqlConnection conn = new SqlConnection(Connection); |
| SqlCommand cmd = new SqlCommand("Slot_sp_EngineerTimeslots_Group", conn); |
| cmd.CommandType = CommandType.StoredProcedure; |
| cmd.Parameters.AddWithValue("@PROPREF", strPropref); |
| cmd.Parameters.AddWithValue("@PRIORITYCODE", PRIORITYCODE); |
| cmd.Parameters.AddWithValue("@JOBLENGTH", "30"); |
| cmd.Parameters.AddWithValue("@TIMESLOT", "AT"); |
| conn.Open(); |
| SqlDataReader reader = cmd.ExecuteReader(); |
| DataTable dt = new DataTable(); |
| dt.Load(reader); |
| DayOfMonth = DateTime.Today.Day; |
| int rows = dt.Rows.Count; |
| endDate = RadCalendar1.SelectedDate.AddDays(rows); |
| foreach (DataRow dr1 in dt.Rows) |
| { |
| startDate = DateTime.Parse(dr1["BookedDate"].ToString()); |
| if (CurrentDate >= startDate.Date && CurrentDate <= endDate.Date) |
| { |
| Label label = new Label(); |
| label.Text = e.Day.Date.Day.ToString(); |
| label.BackColor = System.Drawing.Color.Green; |
| e.Cell.Controls.Add(label); |
| // disable the selection for the specific day |
| RadCalendarDay calendarDay = new RadCalendarDay(); |
| calendarDay.Date = CurrentDate; |
| calendarDay.IsSelectable = true; |
| RadCalendar1.SpecialDays.Add(calendarDay); |
| } |
| CurrentDate.AddDays(1); |
| } |
Hey!
I have a RadGrid that performs a CallBack on Update and Insert. The Code is executed correctly and the Item is updated/inserted in my Collection but on the Client the RadGridItem stays in EditMode. I tried setting item.Edit = "false" at the end of my Insert/Update Method but this did not work and threw an exception.
I'm confused because I thought the default behaviour was for the Item to close after editing. Am I missing something in my RadGrid configuration?
| <telerik:RadGrid ID="gridVariables" runat="server" GridLines="None" AllowPaging="True" |
| AllowSorting="true" CssClass="evaluation_grid" AllowMultiRowEdit="false" |
| meta:resourcekey="gridVariables" |
| onneeddatasource="gridVariables_NeedDataSource" |
| Skin="<%# RadSkin %>" |
| onupdatecommand="gridVariables_UpdateCommand" |
| OnItemDataBound="gridVariables_ItemDataBound" |
| ondeletecommand="gridVariables_DeleteCommand" |
| oninsertcommand="gridVariables_InsertCommand" |
| oncancelcommand="gridVariables_CancelCommand" |
| AllowAutomaticUpdates="true" AllowAutomaticInserts="true" AllowAutomaticDeletes="true" |
| PageSize="10" > |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <ValidationSettings EnableValidation="false" /> |
| <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" TableLayout="Fixed" DataKeyNames="Id" ClientDataKeyNames="Id, Shortname" CommandItemDisplay="Top"> |
| <Columns> |
| <telerik:GridBoundColumn UniqueName="Id" DataField="Id" Visible="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="ShortnameColumn" DataField="Shortname" |
| meta:resourcekey="gbcShortname"> |
| <HeaderStyle Width="70px"/> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="NameColumn" |
| meta:resourcekey="gbcName"> |
| <ItemTemplate> |
| <p> |
| <%# Eval("Name")%> |
| </p> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:TextBox ID="txtName" Width="90%" Enabled="false" runat="server" Text='<%# Bind("Name") %>' /> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn UniqueName="DescriptionColumn" DataField="Description" |
| meta:resourcekey="gbcDescription"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn UniqueName="UnitColumn" DataField="Unit" |
| meta:resourcekey="gbcUnit"> |
| <HeaderStyle Width="70px"/> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn UniqueName="ChangeAttributeColumn"> |
| <HeaderStyle Width="30px"/> |
| <ItemTemplate> |
| <asp:ImageButton ID="btnChangeAttribute" runat="server" BorderWidth="1" CommandArgument='<%# Eval("Shortname") %>' ImageUrl="~/Img/change.gif" meta:resourcekey="btnChangeAttribute" OnPreRender="btnChangeAttribute_PreRender" /> |
| </ItemTemplate> |
| <EditItemTemplate> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridEditCommandColumn CancelImageUrl="~/Img/Cancel_red.gif" |
| EditImageUrl="~/Img/Edit.gif" |
| UniqueName="EditColumn" |
| UpdateImageUrl="~/Img/Update.gif" |
| ButtonType="ImageButton" |
| meta:resourcekey="vrEditColumn"> |
| <HeaderStyle Width="50px" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridButtonColumn UniqueName="DeleteColumn" CommandName="Delete" ButtonType="ImageButton"> |
| <HeaderStyle Width="30px"/> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <CommandItemTemplate> |
| <div style="padding:10px 0px;"> |
| <asp:ImageButton Text="Neu" meta:resourcekey="newValueColumn" |
| ID="btnNew" runat="server" CommandName="InitInsert" ImageAlign="Left" ImageUrl="~/Img/New.gif" |
| CausesValidation="false" OnPreRender="btnNew_PreRender" |
| Visible='<%# !gridVariables.MasterTableView.IsItemInserted %>' /> |
| <asp:LinkButton ID="btnNewVariable" CommandName="InitInsert" OnPreRender="btnNewVariable_PreRender" Visible='<%# !gridVariables.MasterTableView.IsItemInserted %>' CausesValidation="false" runat="server" Height="18px" meta:resourcekey="newValueColumn" /> |
| </div> |
| </CommandItemTemplate> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnRowDblClick="rowDoubleClick" /> |
| <Selecting AllowRowSelect="True"></Selecting> |
| </ClientSettings> |
| </telerik:RadGrid> |
| <telerik:RadGrid ID="RadGrid1" runat="server" Width="960px" AllowPaging="false" PagerStyle-AlwaysVisible="false" HeaderStyle-HorizontalAlign="center" BackColor="#e8eefa" HeaderStyle-Font-Size="8" AllowSorting="false" > |
| <ClientSettings Scrolling-UseStaticHeaders="true" > |
| <Scrolling FrozenColumnsCount="2" SaveScrollPosition="false" ScrollHeight ="350px"/> |
| </ClientSettings> |
| <MasterTableView NoMasterRecordsText="No Matching Record Exists" Name="Master" Width="960px" |
| DataKeyNames="PersonLocationId" EnableColumnsViewState="true" TableLayout="fixed" |
| > |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="PersonSelected" |
| HeaderStyle-Width="15px" ItemStyle-Width="100%" > |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="PersonName" UniqueName="Person" |
| HeaderStyle-Width="120px" ItemStyle-Width="100%" ItemStyle-HorizontalAlign="left"> |
| <ItemTemplate> |
| <asp:Label ID="lblPersonName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.PersonName") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn datafield="Specialty" uniquename="Specialty" Visible="false"> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn uniqueName="Day1" HeaderStyle-Width="35px" ItemStyle-Width="100%" > |
| </telerik:GridTemplateColumn> |
| ..... |
| ..... |
| <telerik:GridTemplateColumn uniqueName="Day31" HeaderStyle-Width="35px" ItemStyle-Width="100%" > |
| </telerik:GridTemplateColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |