| 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> |
function Validate(sender, args)
{
var DataItems = $find("<%=RadGrid3.ClientID %>").get_masterTableView().get_dataItems();
var index =??????????????????????
var cb1 = $telerik.findControl(DataItems[index].get_element(), "RadComboBox1");
var cb2 = $telerik.findControl(DataItems[index].get_element(), "RadComboBox2");
}
When the grid runs in a german version of IE on a german version of the operating system, date columns show their dates using periods separating the day, month and year. What I really want is the format to be whatever I set it to be on the server using whatever regional setting applies to the user. The regional setting is independent of the browser's language or the language of the operating system. It is a web application setting specific for the user. Here is my code example:
| DateTimeFormatInfo dateTimeFormat = new CultureInfo("en-us", false).DateTimeFormat; |
| GridDateTimeColumn colSessionStartTime = this.RadGridSkillsData.Columns.FindByUniqueName("SessionStartTimeLocal") as GridDateTimeColumn; |
| colSessionStartTime.DataFormatString = "{0:" + dateTimeFormat.ShortDatePattern + " " + dateTimeFormat.LongTimePattern + "}"; |
When I view what colSessionStartTime.DataFormatString is set to, it shows up as:
"{0:M/d/yyyy h:mm:ss tt}"
Yet the values that appear in the grid are showing periods rather than slashes for the date.
How can I get the date to format according to any culture code?
Johann