<telerik:RadMenu ID="RadMenu1" runat="server" Style="z-index: 2000" ClickToOpen="true" Visible="true" OnClientItemClosing="OnClientItemClosing"> <items> <telerik:RadMenuItem Text="Card Filter"> <Items> <telerik:RadMenuItem Text="CardFilter"> <ItemTemplate> <table> <tr> <td colspan="2"> <asp:CheckBox runat="server" ID="chkUseFleetFilter" Text="Use fleet filter for cards" Checked="true" AutoPostBack="true" Font-Names="Verdana" Font-Size="0.8em" OnCheckedChanged="chkUseFleetFilter_CheckedChanged" /> </td> <td> </td> </tr> <tr> <td> <asp:RadioButtonList ID="radListDateTime" Enabled="true" runat="server" Font-Names="Verdana" Font-Size="0.8em"> <asp:ListItem Text="Fleet" Value="Fleet" Selected="True" /> </asp:RadioButtonList> </td> <td> </td> </tr> <tr> <td> <asp:Label ID="lblFleetLevel" runat="server" Width="100px" Text="Fleet Level"></asp:Label> </td> <td> <telerik:RadComboBox ID="ddlFleetLevel" runat="server" Width="200px" Enabled="false" OnSelectedIndexChanged="ddlFleetLevel_SelectedIndexChanged" AutoPostBack="true" OnClientDropDownOpening="OnClientDropDownOpening" OnClientDropDownClosed="OnClientDropDownClosed"> </telerik:RadComboBox> </td> </tr> <tr> <td> <asp:Label ID="lblFleetItem" runat="server" Text="Fleet Item" Visible="false"></asp:Label> </td> <td> <telerik:RadComboBox ID="ddlFleetItem" runat="server" Width="200px" Enabled="false" Visible="false" OnClientDropDownOpening="OnClientDropDownOpening" OnClientDropDownClosed="OnClientDropDownClosed"> </telerik:RadComboBox> </td> </tr> <tr> <td> <asp:Label ID="lblFindCard" runat="server" Text="Find Card"></asp:Label> </td> <td> <telerik:RadTextBox ID="txtFindCard" runat="server" Width="200px" Enabled="false"> </telerik:RadTextBox> </td> </tr> <tr> <td> </td> <td align="left"> <telerik:RadButton ID="btnGo" runat="server" Width="50px" Text="Go" ToolTip="Go" Enabled="false" /> </td> </tr> </table> </ItemTemplate> </telerik:RadMenuItem> </Items> </telerik:RadMenuItem> </items> </telerik:RadMenu>
Howdy All,
Not sure the best forum to post this on, so i'll start here... I have two questions here... I have two tables (Settings, and SettingsTypes). One of which (Settings) I'm displaying in a grid. It has a field (SettingType) that is related to an TypeID field in the SettingTypes table. Right now I have the grid display the setting and the integer value for it's settingtype field. I would like to display the related settingtype Name field from the SettingType table. Any Ideas???
My second question is I have a User Defined edit page ( settingsDetail) page that is used when the user "edits" a row in the setting table's grid. the dataitem on that page is the datarow from the settings table. I would like to place on the details page a dropdownlist/combobox of the settingtype names instead of having the user input an integer value. How do I get to the settingtype table from the datarow from the setting table as the datatitem??? I could not find any decent examples of using the User Control page (my details page)... I'm going of the example at: http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/edit-form-types/defaultvb.aspx but that has only a "Hard Coded" dropdown... I would like to get the values from a table NOT "Hard Coded".
As a caveat, I'm a Newbie when it comes to ASP.Net... so bare with me if my questions are a bit basic :-)
Thanks in advance,
Matson Money, Inc.
(513) 204-8000 x8245
(513) 204-8245 (Direct)

<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0"DataSourceID="ODS_attendance" width="1200" PageSize="15" GridLines="None" style="margin-top: 0px" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="True" AllowAutomaticDeletes="false" AllowAutomaticInserts="false"AllowAutomaticUpdates="True"> <GroupingSettings CaseSensitive="false" /> <MasterTableView AutoGenerateColumns="False" DataKeyNames="UserID" DataSourceID="ODS_attendance" AllowFilteringByColumn="False" AllowPaging="False" CommandItemDisplay="Top" OverrideDataSourceControlSorting="true" > <CommandItemSettings ExportToPdfText="Export to PDF" ShowAddNewRecordButton="false" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True"> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderStyle-Width="50"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn UniqueName="UserID" DataField="UserID" HeaderText="UserID" ReadOnly="True" HeaderStyle-Width="5%" Visible="false"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Employee_No" DataType="System.String" FilterControlAltText="Filter Employee column" HeaderText="Employee No" ReadOnly="True" SortExpression="Employee_No" UniqueName="Employee_No" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Employee_Display_Name" DataType="System.String" FilterControlAltText="Filter Employee column" HeaderText="Employee" ReadOnly="True" SortExpression="Employee_Display_Name" UniqueName="Employee_Display_Name" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Department" DataType="System.String" FilterControlAltText="Filter Department column" HeaderText="Reporting office" ReadOnly="True" SortExpression="Department" UniqueName="Department" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Start_Time" FilterControlAltText="Filter Start Time column" HeaderText="Start Date" SortExpression="Start_Time" UniqueName="Start_Date" DataFormatString="{0: dd-MMM-yyyy}" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="End_Time" FilterControlAltText="Filter End Time column" HeaderText="End Date" SortExpression="End_Time" UniqueName="End_Date" DataFormatString="{0: dd-MMM-yyyy}" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Start_Time" FilterControlAltText="Filter Start Time column" HeaderText="Start Time" SortExpression="Start_Time" UniqueName="Start_Time" DataFormatString="{0: hh:mm tt}" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="End_Time" FilterControlAltText="Filter End Time column" HeaderText="End Time" SortExpression="End_Time" UniqueName="End_Time" DataFormatString="{0: hh:mm tt}" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TotalDays" FilterControlAltText="Filter TotalDays column" HeaderText="Total Day" SortExpression="TotalDays" UniqueName="TotalDays" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="TotalHours" FilterControlAltText="Filter TotalDTotalHoursays column" HeaderText="Total Hour" SortExpression="TotalHours" UniqueName="TotalHours" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Type" FilterControlAltText="Filter Type column" HeaderText="Type" SortExpression="Type" UniqueName="Type" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="pre_test_score" FilterControlAltText="Filter pre_test_score column" HeaderText="Pre test score" SortExpression="pre_test_score" UniqueName="pre_test_score" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="post_test_score" FilterControlAltText="Filter post_test_score column" HeaderText="Post test score" SortExpression="post_test_score" UniqueName="post_test_score" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Result" FilterControlAltText="Filter Result column" HeaderText="Result" SortExpression="Result" UniqueName="Result" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Cost" FilterControlAltText="Filter Cost column" HeaderText="Cost" SortExpression="Cost" UniqueName="Cost" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Remarks" FilterControlAltText="Filter Remarks column" HeaderText="Remarks" SortExpression="Remarks" UniqueName="Remarks" AllowFiltering="true" AllowSorting="true"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn> <ItemTemplate> <asp:LinkButton ID="DownloadButton" runat="server" CommandName="DownloadAttachment" Text="Download"> </asp:LinkButton> </ItemTemplate> <EditItemTemplate> <telerik:RadUpload ID="AttachmentUpload" runat="server"> </telerik:RadUpload> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings EditFormType="Template"> <EditColumn FilterControlAltText="Filter EditCommandColumn1 column" UniqueName="EditCommandColumn1"> </EditColumn> <FormTemplate> <table id="Table2" cellspacing="2" cellpadding="1" width="50%" border="1" rules="none" style="border-collapse: collapse;"> <tr class="EditFormHeader"> <td style="width:150px"> <asp:Label ID="Label3" Text="Employee No" runat="server"></asp:Label> </td> <td> <asp:label ID="tb_emp_no" runat="server" Text='<%# Bind("Employee_No") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label2" Text="Employee Name" runat="server"></asp:Label> </td> <td> <asp:label ID="Label4" runat="server" Text='<%# Bind("Employee_Display_Name") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label9" Text="Reporting office" runat="server"></asp:Label> </td> <td> <asp:label ID="Label10" runat="server" Text='<%# Bind("Department") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label5" Text="Start Date & Time" runat="server"></asp:Label> </td> <td> <asp:label ID="Label6" runat="server" Text='<%# Bind("Start_Time","{0: dd-MMM-yyyy hh:mm tt}") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label7" Text="End Date & Time" runat="server"></asp:Label> </td> <td> <asp:label ID="Label8" runat="server" Text='<%# Bind("End_Time","{0: dd-MMM-yyyy hh:mm tt}") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label19" Text="Total Days" runat="server"></asp:Label> </td> <td> <asp:label ID="Label20" runat="server" Text='<%# Bind("TotalDays") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label21" Text="Total Hours" runat="server"></asp:Label> </td> <td> <asp:label ID="Label22" runat="server" Text='<%# Bind("TotalHours") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label11" Text="Training Type" runat="server"></asp:Label> </td> <td> <asp:label ID="Label12" runat="server" Text='<%# Bind("type") %>' ReadOnly="true"></asp:label> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label13" Text="Pre test score" runat="server"></asp:Label> </td> <td> <asp:textbox ID="tb_pre_test_score" runat="server" Text='<%# Bind("pre_test_score") %>' ></asp:textbox> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label15" Text="Post test score" runat="server"></asp:Label> </td> <td> <asp:textbox ID="tb_post_test_score" runat="server" Text='<%# Bind("post_test_score") %>' ></asp:textbox> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label18" Text="Result" runat="server"></asp:Label> </td> <td> <asp:DropDownList runat="Server" SelectedValue='<%# Bind("Result") %>' DataTextField="Result" DataValueField="Result" ID="comboResult"> <asp:ListItem Text="" Value=""></asp:ListItem> <asp:ListItem Text="Pass" Value="Pass"></asp:ListItem> <asp:ListItem Text="Fail" Value="Fail"></asp:ListItem> <asp:ListItem Text="Defer" Value="Defer"></asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label16" Text="Cost" runat="server"></asp:Label> </td> <td> <asp:textbox ID="tb_cost" runat="server" Text='<%# Bind("cost") %>' ></asp:textbox> </td> </tr> <tr> <td style="width:150px"> <asp:Label ID="Label17" Text="Remarks" runat="server"></asp:Label> </td> <td> <asp:textbox ID="tb_remarks" runat="server" Text='<%# Bind("remarks") %>' ></asp:textbox> </td> </tr> <tr> <td> <asp:Label ID="Label14" Text="Certificate" runat="server"></asp:Label> </td> <td> <telerik:RadUpload ID="AttachmentUpload" runat="server"> </telerik:RadUpload> </td> </tr> <tr> <td align="right" colspan="2"> <asp:Button ID="Button1" Text="Update" runat="server" CommandName="Update"></asp:Button> <asp:Button ID="btnDelete" Text="Delete" runat="server" CausesValidation="False" CommandName="Delete" OnClientClick="return conformbox();" visible="false" ></asp:Button> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> </td> </tr> </table> </FormTemplate></EditFormSettings> <PagerStyle PageSizeControlType="RadComboBox" /> </MasterTableView> <PagerStyle PageSizeControlType="RadComboBox" /> <FilterMenu EnableImageSprites="False"> </FilterMenu></telerik:RadGrid> <asp:ObjectDataSource ID="ODS_attendance" runat="server" SelectMethod="GetTrainingRecordsArrayBySessionID" TypeName="LRDB"> <SelectParameters> <asp:QueryStringParameter Name="id" QueryStringField="SessionID" Type="Int32" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="UserID" Type="Int16"></asp:Parameter> <asp:Parameter Name="Remarks" Type="String" /> <%--<asp:Parameter Name="Status" Type="Boolean" />--%> </UpdateParameters></asp:ObjectDataSource><asp:LinqDataSource ID="LDS_Certificate" runat="server" TableName="db_Certificates" ContextTypeName="dcLRDBDataContext" EntityTypeName="" Where="UserID==@UserID"> <SelectParameters> <asp:Parameter Name="UserID" Type="Int32"></asp:Parameter> </SelectParameters></asp:LinqDataSource>Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand RadGrid1.MasterTableView.ClearEditItems() If e.CommandName = RadGrid.InitInsertCommandName Then 'Click Add New Record button Dim editColumn As GridEditCommandColumn = CType(RadGrid1.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn) editColumn.Visible = False ElseIf (e.CommandName = RadGrid.RebindGridCommandName AndAlso e.Item.OwnerTableView.IsItemInserted) Then e.Canceled = True Else Dim editColumn As GridEditCommandColumn = CType(RadGrid1.MasterTableView.GetColumn("EditCommandColumn"), GridEditCommandColumn) If Not editColumn.Visible Then 'Click Cancel button (both Insert and Update mode) editColumn.Visible = True End If Dim txt_pre_test_score As TextBox = DirectCast(e.Item.FindControl("tb_pre_test_score"), TextBox) Dim txt_post_test_score As TextBox = DirectCast(e.Item.FindControl("tb_post_test_score"), TextBox) Dim txt_cost As TextBox = DirectCast(e.Item.FindControl("tb_cost"), TextBox) Dim txt_remarks As TextBox = DirectCast(e.Item.FindControl("tb_remarks"), TextBox) Dim cmb_Result As DropDownList = DirectCast(e.Item.FindControl("comboResult"), DropDownList) Dim dc As New dcLRDBDataContext If e.CommandName = "PerformInsert" Then ElseIf e.CommandName = "Update" Then Dim lid As Integer = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("UserID") HttpContext.Current.Session("EditUserID") = lid Dim rec = (From p In dc.db_Training_Records Where p.UserID = lid).FirstOrDefault If Not rec Is Nothing Then rec.Cost = txt_cost.Text rec.pre_test_score = txt_pre_test_score.Text rec.post_test_score = txt_post_test_score.Text rec.Remarks = txt_remarks.Text rec.Result = cmb_Result.SelectedValue rec.LastUpdateBy = HttpContext.Current.Session("UserID") rec.LastUpdateDate = DateTime.Now dc.SubmitChanges() End If Dim attachmentUpload As RadUpload = DirectCast(e.Item.FindControl("AttachmentUpload"), RadUpload) If attachmentUpload.UploadedFiles.Count > 0 Then Dim file As UploadedFile = attachmentUpload.UploadedFiles(0) Dim stream As System.IO.Stream = file.InputStream Dim binaryData As Byte() = New Byte(stream.Length - 1) {} stream.Read(binaryData, 0, CInt(stream.Length)) 'binaryData contains your uploaded content 'you can save to your database stream.Seek(0, System.IO.SeekOrigin.Begin) Dim newRecord1 As New db_Certificate dc.db_Certificates.InsertOnSubmit(newRecord1) newRecord1.BinaryData = binaryData newRecord1.FileName = file.FileName newRecord1.FileSize = file.ContentLength / 1024 newRecord1.Description = file.GetFieldValue("Description") newRecord1.UploadBy = HttpContext.Current.Session("UserID") newRecord1.UploadDate = DateTime.Now newRecord1.LastUpdatedOn = DateTime.Now newRecord1.LastUpdatedBy = HttpContext.Current.Session("UserID") newRecord1.UserID = lid dc.SubmitChanges() End If RadGrid1.MasterTableView.ClearEditItems() RadGrid1.DataBind() End If dc.Dispose() End If End Sub