or
GridColumn employeeRateCol = RadGridSummary.MasterTableView.Columns.FindByUniqueName("EmployeeRate");GridDropDownColumn rateType = new GridDropDownColumn();int index = RadGridSummary.MasterTableView.Columns.IndexOf(employeeRateCol);RadGridSummary.MasterTableView.Columns.Insert(index, rateType);I
am simply trying to read the selected value of an item that is selected
in RadComboBox but I am unable to do so. The SelectedValue value is
always empty. This is a pretty simple usage case so I don't understand
why this should be difficult. Does anyone know what is going on?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim cmd As New SqlCommand Dim con As New SqlConnection Dim da As New SqlDataAdapter Dim ds As New DataSetIf (Not Page.IsPostBack) Then cmd.Connection = con con.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString con.Open() cmd.CommandText
= "select top 100 CustomerID, isnull(Title, '') as Title, FirstName,
LastName, FirstName + LastName as FullName from saleslt.customer" da.SelectCommand = cmd da.Fill(ds) RadComboBox1.DataValueField = "CustomerID" RadComboBox1.DataTextField = "FullName" RadComboBox1.DataSource = ds RadComboBox1.DataBind()
end if End SubProtected
Sub RadComboBox1_SelectedIndexChanged(ByVal o As Object, ByVal e As
Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles
RadComboBox1.SelectedIndexChanged Dim s As String s = e.Value s = RadComboBox1.SelectedValueEnd Sub
<telerik:RadComboBox ID="RadComboBox1" runat="server" Width="420"
AllowCustomText="True" MaxHeight="300px" Filter="Contains" AutoPostBack="True"> <HeaderTemplate> <ul> <li class="col1">Title</li> <li class="col2">First Name</li> <li class="col3">Last Name</li> </ul> </HeaderTemplate> <ItemTemplate> <ul> <li class="col1"><%#DataBinder.Eval(Container.DataItem, "Title").ToString()%></li> <li class="col2"><%#DataBinder.Eval(Container.DataItem, "FirstName").ToString()%></li> <li class="col3"><%#DataBinder.Eval(Container.DataItem, "LastName").ToString()%></li> </ul> </ItemTemplate></telerik:RadComboBox><%@ Page Title="" Language="VB" MasterPageFile="~/Pages/SiteMaster.master" AutoEventWireup="false" CodeFile="TestCustomers.aspx.vb" Inherits="Pages_Bookings_Customers" %> <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="phTopContent" Runat="Server"> </asp:Content> <asp:Content ID="Content3" ContentPlaceHolderID="phMainContent" Runat="Server"> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" MinDisplayTime="100" Skin="Sunset"> </telerik:RadAjaxLoadingPanel> <div style="float: none; clear: both"> <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="dsCustomers" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" GridLines="None" Width="500px" Height="700px" PageSize="20" ShowStatusBar="True" Skin="Sunset" EnableAJAXLoadingTemplate="True" EnableAJAX="True"> <MasterTableView DataKeyNames="CustomerID" DataSourceID="dsCustomers" AutoGenerateColumns="False" CommandItemDisplay="Top" EditMode="PopUp"> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderStyle-Width="40px"> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="CustomerID" DataType="System.Int32" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" UniqueName="CustomerID" Visible="true"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CustName" HeaderText="Customer Name" SortExpression="CustName" UniqueName="CustName" Visible="True"> </telerik:GridBoundColumn> </Columns> <EditFormSettings EditFormType="Template" CaptionFormatString='Edit Customer: {0}' CaptionDataField="CustName" InsertCaption="Add New Customer" PopUpSettings-Width="400px"> <EditColumn UniqueName="EditCommandColumn1"></EditColumn> <FormTemplate> <table id="outer_table"> <tr> <td NOWRAP> <asp:Label ID="Label1" runat="server" Text="Customer Name:" AssociatedControlID="tbCustName" /> </td> <td> <telerik:RadTextBox ID="tbCustName" runat="server" width="250px" Text='<%# Bind( "CustName" ) %>'> </telerik:RadTextBox> </td> </tr> <tr> <td nowrap style="vertical-align: top"> <asp:Label ID="Label17" runat="server" Text="Default Booking Contact:" AssociatedControlID="cbBookingContact" /> </td> <td> <telerik:RadComboBox ID="cbBookingContact" Runat="server" Skin="Sunset" DataSourceID="dsBookingContact" DataTextField="ContactName" DataValueField="ContactID" SelectedValue='<%# Bind("DefaultBookingContactID") %>' Width="255" MarkFirstMatch="True" Filter="Contains" AppendDataBoundItems="True" Text="Select a contact"> <Items> <telerik:RadComboBoxItem Value="" Text=""/> </Items> </telerik:RadComboBox> </td> </tr> <tr> <td align="left" colspan="2"> <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' /> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button></td> </tr> </table> </FormTemplate> </EditFormSettings> </MasterTableView> <GroupingSettings CaseSensitive="False" /> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> </ClientSettings> </telerik:RadGrid> <asp:SqlDataSource ID="dsCustomers" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT Customers.CustomerID, Customers.CustName, Customers.DefaultBookingContactID FROM Customers LEFT OUTER JOIN AccountStatus ON Customers.AccountStatusID = AccountStatus.AccountStatusID ORDER BY Customers.CustCode" InsertCommand="INSERT INTO [Customers] ([CustName], [DefaultBookingContactID]) VALUES (@CustName, @CustCode, @DefaultBookingContactID)" UpdateCommand="UPDATE [Customers] SET [CustName] = @CustName, [DefaultBookingContactID] = @DefaultBookingContactID WHERE [CustomerID] = @CustomerID"> <UpdateParameters> <asp:Parameter Name="CustName" Type="String" /> <asp:Parameter Name="DefaultBookingContactID" Type="Int32" /> <asp:Parameter Name="CustomerID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="CustName" Type="String" /> <asp:Parameter Name="DefaultBookingContactID" Type="Int32" /> </InsertParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="dsBookingContact" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT ContactID, ContactName, CustomerID FROM Contacts WHERE (CustomerID = @CustomerID) ORDER BY ContactName"> <SelectParameters> <asp:ControlParameter ControlID="RadGrid1" Name="CustomerID" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> </div> </asp:Content>hi
i have a grid in a nested view template with a GridDateTimeColumn in it , but on insert/edit mode the datepicker does not show , it simply seems to go to the top of the screen when the picker button is clicked ,
the column is created as follows :-
| private GridDateTimeColumn CreateDateGridColumn(XmlAttribute xAtt, XmlNode xControl, RadAjaxPanel PlaceHolder1) |
| { |
| System.Web.UI.Control Test = Builder.FindControl(PlaceHolder1.Controls, xAtt.Name + "Editor"); |
| if (Test.ID == null) |
| { |
| GridDateTimeColumnEditor DTE = new GridDateTimeColumnEditor(); |
| DTE.ID = xAtt.Name + "Editor"; |
| PlaceHolder1.Controls.Add(DTE); |
| } |
| GridDateTimeColumn DT = new GridDateTimeColumn(); |
| DT.UniqueName = xAtt.Name; |
| DT.HeaderText = xControl.Attributes["Caption"].Value; |
| DT.PickerType = GridDateTimeColumnPickerType.DatePicker; |
| DT.DataFormatString = "{0:MM/dd/yyyy}"; |
| DT.ColumnEditorID = xAtt.Name + "Editor"; |
| DT.DataField = xAtt.Name; |
| DT.SortExpression = xAtt.Name; |
| DT.ItemStyle.Width = Unit.Pixel(120); |
| DT.FilterControlWidth = Unit.Pixel(50); |
| DT.DataType = System.DateTime; |
| DT.EmptyDataText = " "; |
| return DT; |
| } |