| rgMemberResult.ExportSettings.ExportOnlyData = true; |
| rgMemberResult.ExportSettings.IgnorePaging = true; |
| rgMemberResult.ExportSettings.OpenInNewWindow = true; |
| rgMemberResult.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML; |
| this.rgMemberResult.MasterTableView.ExportToExcel(); |
Dim testId As Int16
testId =
CInt(e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("id"))
Select Case e.CommandName.ToLower()
Case "edit"
RGChoiceItems.EditIndexes.Add(e.Item.ItemIndex)
Case "cancel"
RGChoiceItems.EditIndexes.Clear()
Case "update"
If UpdateTest(False, e) Then
msg.ShowOK("Updated")
End If
End Select
LoadChoiceGroupTypeItems()
But it never clears the Edit mode even if the data gets updated. UpdateTest() methods works well. I want to do axactly as your first example grid but it is never gets rid of edit mode..I have to refresh the page again!
3) whereas, Cancel button moves the grid in normal mode again but problem with cancel is when I cancel 1 row it cancels all other rows in edit mode.
any idea what I am missing?
//Error: object required
img.style.height = sliderValue/150 * imageHeight + "px";
}
</script>
<img src="Images/top.gif" alt="" style="display:block;"/><div style="background:white;float:left;width:412px;height:280px;overflow:auto;"><img id="img_preview" src="Images/pic.gif" alt=""/></div><div style="float:left;background-image:url(Images/SliderBckg.gif);height:280px;background-repeat:no-repeat;width:87px;padding-top:5px;padding-left:31px;">
<telerik:RadSlider ID="zoomSlider" runat="server"
Value="150"
MaximumValue="250"
MinimumValue="50"
OnClientValueChange="ZoomImage"
Orientation="Vertical"
Length="206"
ShowDecreaseHandle="false"
ShowIncreaseHandle="false"
/>
</div>
</
asp:Content>
| protected void FormViewSkillDetails_DataBound(object sender, EventArgs e) | |
| { | |
| //START: CODE REQUIREMENTS OF THE INSERT ITEM TEMPLATE OF THE FORM VIEW CONTROL. | |
| if (FormViewSkillDetails.CurrentMode == FormViewMode.Insert) | |
| { | |
| FormViewSkillDetails.Focus(); //place the cursor on the 1st available field of the form view. | |
| //START: HIDE / SHOW THE INSERT SKILL OWN HEADING DETERMINED BY THE VALUE IN THE DROP DOWN LIST. | |
| RadComboBox ddl = (RadComboBox)FormViewSkillDetails.FindControl("RadComboBoxSkillTypeInsertDisplay"); | |
| Panel p = (Panel)FormViewSkillDetails.FindControl("PanelSkillOwnHeadingInsertItem"); | |
| RequiredFieldValidator rfv = (RequiredFieldValidator)FormViewSkillDetails.FindControl("RequiredFieldValidatorClientSideSkillOwnHeadingInsert"); | |
| CustomValidator cvss = (CustomValidator)FormViewSkillDetails.FindControl("CustomValidatorServerSideSkillOwnHeadingInsertItemBlank"); | |
| ddl.Attributes.Add("onchange", "JavaScript:selectInputInsertChange('" + ddl.ClientID + "', '" + p.ClientID + "', '" + rfv.ClientID + "', '" + cvss.ClientID + "');"); | |
| //FINISH: HIDE / SHOW THE INSERT SKILL OWN HEADING DETERMINED BY THE VALUE IN THE DROP DOWN LIST. | |
| } | |
| //FINISH: CODE REQUIREMENTS OF THE INSERT ITEM TEMPLATE OF THE FORM VIEW CONTROL. | |
| } |
| <script type="text/javascript"> | |
| function selectInputInsertChange(ddl_id, pan_id, rfv_id, cvss_id) { | |
| var ddl = document.getElementById(ddl_id); | |
| var pan = document.getElementById(pan_id); | |
| var rfv = document.getElementById(rfv_id); | |
| var cvss = document.getElementById(cvss_id); | |
| if (ddl.value == "817") { | |
| pan.style.display = 'inline'; | |
| ddl.focus(); | |
| rfv.enabled = true; | |
| cvss.enabled = true; | |
| } | |
| else { | |
| pan.style.display = 'none'; | |
| ddl.focus(); | |
| rfv.enabled = false; | |
| cvss.enabled = false; | |
| } | |
| } | |
| </script> |
| <telerik:RadComboBox ID="RadComboBoxSkillTypeInsertDisplay" | |
| DataSourceID="ObjectDataSourceSkillDetailsSkillType" | |
| DataTextField="SkillTypeDescriptionIntl" | |
| DataValueField="SkillTypeID" | |
| Dir="<%$ Resources:Resource, TextDirection %>" | |
| Runat="server" | |
| SelectedValue='<%# Bind("SkillTypeID")%>' | |
| Skin="Black" /> | |
| <asp:DropDownList ID="DropDownListSkillTypeInsertDisplay" | |
| CssClass="si" | |
| DataSourceID="ObjectDataSourceSkillDetailsSkillType" | |
| DataTextField="SkillTypeDescriptionIntl" | |
| DataValueField="SkillTypeID" | |
| onBlur="TBC(this,0)" | |
| onFocus="TBC(this,1)" | |
| Runat="Server" | |
| SkinID="DropDownListStandard" /> | |
| <asp:RequiredFieldValidator ID="RequiredFieldValidatorRadComboBoxSkillTypeInsertDisplay" ControlToValidate="RadComboBoxSkillTypeInsertDisplay" Display="None" EnableClientScript="true" ErrorMessage="<%$ Resources:SkillErrorMessageSkillType.Text %>" InitialValue="0" Runat="Server" SetFocusOnError="true" /> | |
| <asp:Image ID="ImageRequiredSkillTypeInsertItem" BorderWidth="0" ImageUrl="~/Images/icon_required.gif" Runat="Server" /> | |
| <asp:RequiredFieldValidator ID="RequiredFieldValidatorSkillTypeInsert" ControlToValidate="DropDownListSkillTypeInsertDisplay" Display="None" EnableClientScript="true" ErrorMessage="<%$ Resources:SkillErrorMessageSkillType.Text %>" InitialValue="0" Runat="Server" SetFocusOnError="true" /> | |
| </div> | |
| </div> | |
| <asp:Panel ID="PanelSkillOwnHeadingInsertItem" CssClass="noFlickering" runat="server" > | |
| <div class="standardDisplay"> | |
| <div class="prompt_right_insert_20"> | |
| <asp:Label ID="LabelSkillOwnHeadingInsertItemPrompt" Runat="Server" Text="<%$ Resources:SkillPromptOwnSkillType.Text %>" Visible="false" /> | |
| </div> | |
| <div class="display_left_80"> | |
| <asp:TextBox ID="TextBoxSkillOwnHeadingInsertDisplay" CssClass="si" MaxLength="150" onBlur="TBC(this,0)" onFocus="TBC(this,1)" Runat="Server" SkinID="TextBoxStandard" Text='<%# Bind("SkillOwnHeading")%>' Width="75%" /> | |
| <asp:Image ID="ImageRequiredSkillOwnHeadingInsert" BorderWidth="0" ImageUrl="~/Images/icon_required.gif" Runat="Server" /> | |
| <asp:RequiredFieldValidator ID="RequiredFieldValidatorClientSideSkillOwnHeadingInsert" ControlToValidate="TextBoxSkillOwnHeadingInsertDisplay" Display="None" Enabled="false" ErrorMessage="<%$ Resources:SkillErrorMessageSkillOwnHeading.Text %>" Runat="Server" SetFocusOnError="true" /> | |
| <asp:CustomValidator ID="CustomValidatorServerSideSkillOwnHeadingInsertItemBlank" ControlToValidate="TextBoxSkillOwnHeadingInsertDisplay" Display="None" Enabled="false" ErrorMessage="<%$ Resources:SkillErrorMessageSkillOwnHeading.Text %>" OnServerValidate="CustomValidatorItemBlank_ServerValidate" Runat="Server" SetFocusOnError="true" ValidateEmptyText="True" /> | |
| </div> | |
| </div> | |
| </asp:Panel> | |
| <cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtenderSkillOwnHeadingInsert" runat="server" Collapsed="true" CollapsedSize="0" SuppressPostBack="true" TargetControlID="PanelSkillOwnHeadingInsertItem" /> | |
| <telerik:RadGrid ID="CompetitionRounds" runat="server" Enabled="False" AutoGenerateColumns="False" | |
| DataSourceID="dsCompetitionRounds" GridLines="None" Width="400px" AllowAutomaticUpdates="True"> | |
| <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true"> | |
| <Selecting AllowRowSelect="true" /> | |
| </ClientSettings> | |
| <MasterTableView DataSourceID="dsCompetitionRounds" NoMasterRecordsText="No competition rounds" | |
| DataKeyNames="RoundNumber" CommandItemDisplay="None" EditMode="PopUp" AllowAutomaticInserts="False" | |
| AllowAutomaticUpdates="true" AllowAutomaticDeletes="false"> | |
| <RowIndicatorColumn> | |
| <HeaderStyle Width="20px"></HeaderStyle> | |
| </RowIndicatorColumn> | |
| <ExpandCollapseColumn> | |
| <HeaderStyle Width="20px"></HeaderStyle> | |
| </ExpandCollapseColumn> | |
| <SortExpressions> | |
| <telerik:GridSortExpression FieldName="RoundNumber" SortOrder="Ascending" /> | |
| </SortExpressions> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="CourseId" DataType="System.Guid" Display="False" | |
| EmptyDataText="" HeaderText="CourseId" SortExpression="CourseId" UniqueName="CourseId" | |
| Visible="False"> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="RoundNumber" DataType="System.Byte" EmptyDataText="" | |
| HeaderText="#" HeaderTooltip="Round Number" ItemStyle-HorizontalAlign="Center" | |
| SortExpression="RoundNumber" UniqueName="RoundNumber"> | |
| <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="10px" /> | |
| <ItemStyle HorizontalAlign="Center" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="RoundDate" DataFormatString="{0:dd/MM/yyyy HH:mm}" | |
| DataType="System.DateTime" EmptyDataText="" HeaderText="Date" HeaderTooltip="Round Date" | |
| SortExpression="RoundDate" UniqueName="RoundDate"> | |
| <HeaderStyle VerticalAlign="Top" Width="110px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="Name" EmptyDataText="" HeaderText="Course" ReadOnly="True" | |
| SortExpression="Name" UniqueName="Name"> | |
| <HeaderStyle VerticalAlign="Top" Width="150px" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="GentsStandardScratch" DataType="System.Byte" | |
| EmptyDataText="" HeaderText="GSI" HeaderTooltip="Gents Standard Scratch" ItemStyle-HorizontalAlign="Center" | |
| ReadOnly="True" SortExpression="GentsStandardScratch" UniqueName="GentsStandardScratch"> | |
| <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="10px" /> | |
| <ItemStyle HorizontalAlign="Center" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridBoundColumn DataField="LadiesStandardScratch" DataType="System.Byte" | |
| EmptyDataText="" HeaderText="LSI" HeaderTooltip="Ladies Standard Scratch" ItemStyle-HorizontalAlign="Center" | |
| ReadOnly="True" SortExpression="LadiesStandardScratch" UniqueName="LadiesStandardScratch"> | |
| <HeaderStyle HorizontalAlign="Center" VerticalAlign="Top" Width="10px" /> | |
| <ItemStyle HorizontalAlign="Center" /> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelImageUrl="/Images/Cancel.gif" | |
| EditImageUrl="/Images/Edit.gif" UpdateImageUrl="/Images/Update.gif"> | |
| <HeaderStyle Width="10px" /> | |
| </telerik:GridEditCommandColumn> | |
| </Columns> | |
| <EditFormSettings EditFormType="Template"> | |
| <FormTemplate> | |
| <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" | |
| style="border-collapse: collapse; background: white;"> | |
| <tr> | |
| <td> | |
| <table id="EditTable" cellspacing="1" cellpadding="1" width="250" border="0"> | |
| <tr> | |
| <td> | |
| <img src="/Images/blank.gif" alt="" height="1px" width="70px" /> | |
| </td> | |
| <td> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| Round: | |
| </td> | |
| <td> | |
| <telerik:RadNumericTextBox ID="numRoundNumber" DbValue='<%# Bind( "RoundNumber" ) %>' | |
| Enabled="true" ReadOnly="true" runat="server" NumberFormat-DecimalDigits="0" | |
| Width="40px" ShowSpinButtons="false" MinValue="1" MaxValue="72" /> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| Course: | |
| </td> | |
| <td> | |
| <telerik:RadComboBox ID="lstCourseName" runat="server" DataSourceID="dsCourseNames" | |
| SelectedValue='<%# Bind("CourseId") %>' DataTextField="Name" DataValueField="Id" | |
| Width="130px"> | |
| </telerik:RadComboBox> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td> | |
| Date: | |
| </td> | |
| <td> | |
| <telerik:RadDateTimePicker ID="dtmRoundDate" runat="server" DbSelectedDate='<%# Bind("RoundDate") %>' | |
| Skin="Default" Width="150px"> | |
| <TimePopupButton HoverImageUrl="" ImageUrl="" /> | |
| <TimeView ID="TimeView1" runat="server" StartTime="05:00" Interval="00:30" EndTime="21:00" | |
| CellSpacing="-1"> | |
| </TimeView> | |
| <Calendar ID="Calendar1" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" | |
| ViewSelectorText="x"> | |
| </Calendar> | |
| <DatePopupButton HoverImageUrl="" ImageUrl="" /> | |
| </telerik:RadDateTimePicker> | |
| </td> | |
| </tr> | |
| </table> | |
| </td> | |
| <td> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td align="right" colspan="2"> | |
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' | |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> | |
| </asp:Button> | |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" | |
| CommandName="Cancel"></asp:Button> | |
| </td> | |
| </tr> | |
| </table> | |
| </FormTemplate> | |
| </EditFormSettings> | |
| </MasterTableView> | |
| </telerik:RadGrid> | |
| <asp:SqlDataSource ID="dsCompetitionRounds" runat="server" ConnectionString="<%$ ConnectionStrings:dbGolfHonoursConnectionString %>" | |
| SelectCommand="leaderboard.lb_SelectCompetitionRound" SelectCommandType="StoredProcedure" | |
| InsertCommand="leaderboard.lb_InsertCompetitionRound" InsertCommandType="StoredProcedure" | |
| UpdateCommand="leaderboard.lb_UpdateCompetitionRound" UpdateCommandType="StoredProcedure" | |
| DeleteCommand="leaderboard.lb_DeleteCompetitionRound" DeleteCommandType="StoredProcedure"> | |
| <SelectParameters> | |
| <asp:ControlParameter ControlID="Menu$lstCompetitionList" DbType="Guid" Name="CompetitionId" | |
| PropertyName="SelectedValue" /> | |
| </SelectParameters> | |
| <InsertParameters> | |
| <asp:ControlParameter ControlID="Menu$lstCompetitionList" DbType="Guid" Name="CompetitionId" | |
| PropertyName="SelectedValue" /> | |
| <asp:Parameter Name="CourseId" DbType="Guid" /> | |
| <asp:Parameter Name="RoundNumber" Type="Int16" /> | |
| <asp:Parameter Name="RoundDate" Type="DateTime" /> | |
| </InsertParameters> | |
| <UpdateParameters> | |
| <asp:ControlParameter ControlID="Menu$lstCompetitionList" DbType="Guid" Name="CompetitionId" | |
| PropertyName="SelectedValue" /> | |
| <asp:Parameter Name="CourseId" DbType="Guid" /> | |
| <asp:Parameter Name="RoundNumber" Type="Int16" /> | |
| <asp:Parameter Name="RoundDate" Type="DateTime" /> | |
| </UpdateParameters> | |
| <DeleteParameters> | |
| <asp:ControlParameter ControlID="Menu$lstCompetitionList" DbType="Guid" Name="CompetitionId" | |
| PropertyName="SelectedValue" /> | |
| <asp:Parameter Name="RoundNumber" Type="Int16" /> | |
| </DeleteParameters> | |
| </asp:SqlDataSource> |
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.PerformInsertCommandName) |
| { |
| } |
| else if (e.CommandName == RadGrid.UpdateCommandName) |
| { |
| } |
| else if (e.CommandName == RadGrid.DeleteCommandName) |
| { |
| } |
| else if (e.CommandName == RadGrid.EditCommandName) |
| { |
| GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn"); |
| GridEditableItem item = (GridEditableItem)e.Item; |
| RadGrid Roles = (RadGrid)FindControlRecursive(this, "RadGrid2"); |
| DataTable dtTable2 = new DataTable(); |
| string conn2 = ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(); |
| SqlDataAdapter sqladp2 = new SqlDataAdapter(); |
| SqlConnection sqlconn2 = new SqlConnection(conn2); |
| sqlconn2.Open(); |
| try |
| { |
| string selectQuery2 = "SELECT [RoleID], [Rolename] FROM [vw_UsersinRoles] WHERE [UserID] = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UserID"].ToString() + " ORDER BY [Username]"; |
| sqladp2.SelectCommand = new SqlCommand(selectQuery2, sqlconn2); |
| sqladp2.Fill(dtTable2); |
| Roles.DataSource = dtTable2; |
| Roles.DataBind(); |
| } |
| finally |
| { |
| sqlconn2.Close(); |
| } |
| } |
| } |
| public Control FindControlRecursive(Control root, string id) |
| { |
| if (root.ID == id) |
| { |
| return root; |
| } |
| foreach (Control c in root.Controls) |
| { |
| Control t = FindControlRecursive(c, id); |
| if (t != null) |
| { |
| return t; |
| } |
| } |
| return null; |
| } |
| <form id="form1" runat="server"> |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True" |
| AllowSorting="True" GridLines="None" Width="623px" AutoGenerateColumns="false" |
| AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" |
| GroupingSettings-CaseSensitive="false" PageSize="20" EnableLinqExpressions="False" |
| ShowStatusBar="True" OnPageIndexChanged="RadGrid1_PageIndexChanged" OnItemCommand="RadGrid1_ItemCommand" |
| OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"> |
| <MasterTableView ShowFooter="False" CommandItemSettings-AddNewRecordText="Add New Contact" |
| CommandItemDisplay="TopAndBottom" DataKeyNames="UserID"> |
| <CommandItemSettings AddNewRecordText="Add New Form"></CommandItemSettings> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn HeaderStyle-Width="15px" EditText="View / Edit"> |
| <HeaderStyle Width="15px"></HeaderStyle> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridTemplateColumn UniqueName="DeleteColumn" ItemStyle-Width="16px" AllowFiltering="false"> |
| <HeaderStyle Width="16px" /> |
| <ItemTemplate> |
| <asp:ImageButton ID="imgbtnDelete" Width="14px" ToolTip="Delete Contact" runat="server" |
| CommandName="Delete" ImageUrl="~/images/recycle.jpg" OnClientClick="javascript:if(!confirm('This action will delete the selected contact. Are you sure?')){return false;}" /> |
| </ItemTemplate> |
| <ItemStyle Width="16px"></ItemStyle> |
| </telerik:GridTemplateColumn> |
| <telerik:GridBoundColumn DataField="Username" HeaderText="Username" SortExpression="Username" |
| UniqueName="Username"> |
| </telerik:GridBoundColumn> |
| </Columns> |
| <EditFormSettings CaptionFormatString="Edit details for User {0}" EditFormType="Template"> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| <FormTemplate> |
| <table> |
| <tr> |
| <td> |
| <telerik:RadGrid ID="RadGrid2" runat="server" OnItemDataBound="RadGrid2_ItemDataBound" |
| AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AutoGenerateColumns="False" |
| GridLines="None"> |
| </telerik:RadGrid> |
| </td> |
| </tr> |
| <tr> |
| <td> |
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> |
| </asp:Button> <asp:Button CausesValidation="false" ID="btnEdit" Text="EditContact" |
| runat="server" CommandName="EditContact"></asp:Button> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" |
| CommandName="Cancel"></asp:Button> |
| </td> |
| </tr> |
| <table> |
| </FormTemplate> |
| </EditFormSettings> |
| <NoRecordsTemplate> |
| No Records</NoRecordsTemplate> |
| </MasterTableView> |
| <GroupingSettings CaseSensitive="False"></GroupingSettings> |
| </telerik:RadGrid> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| </form> |