Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
213 views

Under the RadListView you suggest the following:


RadControls for ASP.NET AJAX

Collapse imageAccessing controls in the LayoutTemplate

To get reference to a control in RadListView LayoutTemplate you can use its FindControl(controlId) method.

CopyC#
protected void RadListView1_PreRender(object sender, EventArgs e)
{
    Label lbl = RadListView1.FindControl("Label1") as Label;
}

I can't make it work. 
My code:
<telerik:RadListView ID="RadListView1" runat="server" AllowPaging="True"
    ItemPlaceholderID="PlaceHolder1" onitemcreated="RadListView1_ItemCreated"
    onprerender="RadListView1_PreRender" >
    <LayoutTemplate>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    </LayoutTemplate>
    <ItemTemplate>
        <div style="float: left;">
            <fieldset style="border: 0; width: 154px; height: 154px; margin: 5px 5px 5px 5px;">
                <div class="myClass" style="padding: 2px 2px 2px 2px; background: #eeeeee; text-align: center;">
                    <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AutoAdjustImageControlSize="False"
                        CssClass="myClass" ImageUrl='<%# Eval("thumbUrl") %>' ResizeMode="Fit" AlternateText="Click to view preview"
                        ToolTip="Click to view preview" Width="150px" Height="150px" />
                </div>
            </fieldset>
            <div style="border: 0px; white-space: normal; width: 150px; margin: 5px 5px 5px 5px;
                padding: 2px 2px 2px 2px;">
                <asp:CheckBox ID="chkImage" runat="server" AutoPostBack="True" />
                <asp:HyperLink ID="lnkAsset" Target="_blank" NavigateUrl='javascript:void(0);' runat="server"><%# Eval("filename") %></asp:HyperLink>
                <asp:HiddenField ID="hiddenAssetId" Value='<%# Eval("id") %>' runat="server" />
            </div>
        </div>
    </ItemTemplate>
    <EmptyDataTemplate>
        No Assets Found
    </EmptyDataTemplate>
</telerik:RadListView>
Code behind:
protected void RadListView1_PreRender (object sender, EventArgs e)
{
    HyperLink lnkAsset = RadListView1.FindControl ("lnkAsset") as HyperLink;
    lnkAsset.Attributes.Add ("OnClick", "javascript:void(assetInfoPopUp(assetId));return false;");
}
lnkAsset is null.
Shinu
Top achievements
Rank 2
 answered on 19 Jul 2011
10 answers
307 views
Hello. I have a question. I have a Grid. There's a ComboBox with DataSource with 3 fields. I want a grid TemplateColumn TeamName (Label.Text) binding with a ComboBox DataSource-Fields( not ComboBox.Value, not ComboBox.Text). I too would like a ComboBox SelectedIndexChanged TemplateColumn TeamName also changed. Is it possible?

<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0"
            DataSourceID="SqlDataSource1" GridLines="None">
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Number"
                DataSourceID="SqlDataSource1">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="Number" DataType="System.Int32"
            FilterControlAltText="Filter Number column" HeaderText="Number" ReadOnly="True"
            SortExpression="Number" UniqueName="Number">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
            HeaderText="Year" UniqueName="TemplateYear" DataField="Year">
            <ItemTemplate>
                <telerik:RadComboBox ID="RadComboBox1" Runat="server"
                    SelectedValue='<%# Bind("Year") %>'>
                    <Items>
                        <telerik:RadComboBoxItem runat="server" Text="2009" Value="2009" />
                        <telerik:RadComboBoxItem runat="server" Text="2010" Value="2010" />
                        <telerik:RadComboBoxItem runat="server" Text="2011" Value="2011" />
                    </Items>
                </telerik:RadComboBox>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
            HeaderText="Team" UniqueName="TemplateColumn1" DataField="Team">
            <ItemTemplate>
                <telerik:RadComboBox ID="RadComboBox2" Runat="server"
                    DataSourceID="SqlDataSource2" DataTextField="Code" DataValueField="Code"
                    SelectedValue='<%# Bind("Team") %>'
                    onselectedindexchanged="RadComboBox2_SelectedIndexChanged"
                    AutoPostBack="True" onitemdatabound="RadComboBox2_ItemDataBound">
                </telerik:RadComboBox>
                
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn2 column"
            HeaderText="TeamName" UniqueName="TemplateColumn2">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server"
                    Text='<%# Bind("RadComboBox2.Attributes("Name")") %>'></asp:Label>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:webzeus %>"
             
            SelectCommand="SELECT top 15 [Number], [Year], [Team] FROM [Project] WHERE year >2008 and year <2012">
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server"
                    ConnectionString="<%$ ConnectionStrings:webs %>"
                    SelectCommand="SELECT [Code], [Name], [Manager] FROM [Team] WHERE ([disabled] = @disabled)">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="false" Name="disabled" Type="Boolean" />
                    </SelectParameters>
        </asp:SqlDataSource>
     
    </div>
    </form>
</body>
Thanks
Princy
Top achievements
Rank 2
 answered on 19 Jul 2011
3 answers
213 views
In my Scheduler when I dbl-click on the scheduler to schedule a new appt, click on "Options", I don't see any of the advanced options such as recurrence there.  How do I get these to show up?

Here's a screenshot of what I see.

Here's my control in my .ASPX page

<telerik:RadScheduler ID="rscSchedule" runat="server" 
    DataKeyField="Appointment_ID"
    DataEndField="EndTime" 
    DataStartField="StartTime" 
    DataSubjectField="Subject" 
    AllowInsert="true" 
    AllowDelete="true" 
    AllowEdit="true"
    DayStartTime="05:00:00" 
    DayEndTime="19:00:00" 
    FirstDayOfWeek="Monday"
    LastDayOfWeek="Friday"
    MinutesPerRow="15" 
    ShowViewTabs="true" 
    ShowFooter="false"
    WorkDayStartTime="05:00:00" 
    WorkDayEndTime="19:00:00"
    EnableDescriptionField="true"
AppointmentStyleMode="Default"
    Width="900"
    Height="700"
    GroupBy="Nurses" 
    OnAppointmentInsert="rscSchedule_Insert"
    OnAppointmentDelete="rscSchedule_Delete" 
    OnAppointmentUpdate="rscSchedule_Update"
    OnAppointmentClick="rscSchedule_Click" 
    OnAppointmentDataBound="rscSchedule_AppointmentDataBound" 
    OnNavigationComplete="rscSchedule_NavigationComplete">
<AdvancedForm Enabled="true" EnableCustomAttributeEditing="false" EnableResourceEditing="false" Modal="true" />
<TimelineView UserSelectable="false" />
<ResourceTypes>
    <telerik:ResourceType Name="Nurses" KeyField="Staff_ID" TextField="FullNameUpperCase" ForeignKeyField="Staff_ID" />
</ResourceTypes>
<TimeSlotContextMenuSettings EnableDefault="true" />
<AppointmentContextMenuSettings EnableDefault="true" /> 
</telerik:RadScheduler>
Scott Hodson
Top achievements
Rank 1
 answered on 18 Jul 2011
1 answer
133 views
I'm using 2011_2_712 and have Uploaded a project here.

I'm using a RadTabStrip to dynamically load various User Controls. Events on these user controls sometimes take multiple firings for them to land on the event handlers.

To see this,
1. Put a breakpoint on the Select statement of rgOrders_ItemCommand()
2. Navigate to Default.aspx
3. Press "Select" for one of the customers. (The first one, Alfreds Futterkiste has orders)
4. Click the Orders tab.
5. Click Select for one of the orders.
Notice the postback is lost.

6. Press Select again and the postback is correct.

In my real project it takes 2 postbacks for one telerik control and 3 for another.  Can anyone make sense of this or tell me what I'm doing wrong?

Thanks,
Dan
Dan Lehmann
Top achievements
Rank 1
 answered on 18 Jul 2011
4 answers
149 views
When exporting a Radgrid using ExcelML format, how can I set a property that is not defined in the WorkSheetOptionsElement?  For example, within the WorkSheetOptions XML, there can be a property named Zoom that allows you to set the Zoom of the Worksheet.  Can these be added using the InnerElements.Add Method and if so, how?

<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
   <Print>
    <ValidPrinterInfo/>
    <VerticalResolution>0</VerticalResolution>
   </Print>
   <Zoom>75</Zoom>
   <Selected/>
   <Panes>
    <Pane>
     <Number>3</Number>
     <ActiveRow>18</ActiveRow>
     <ActiveCol>4</ActiveCol>
    </Pane>
   </Panes>
   <ProtectObjects>False</ProtectObjects>
   <ProtectScenarios>False</ProtectScenarios>
  </WorksheetOptions>
Chris
Top achievements
Rank 1
 answered on 18 Jul 2011
7 answers
398 views
Does not look like the RadListBox (SelectionMode="Multiple) has a "max # of allowable selected items" attribute, so how may I programmatically limit it client side?

I've got the following so far. But how do I basically say if the # of selectable items is greater than 5, then remove the last selected item?

Thanks! (fyi, I did an extensive search of the forums, and documentation but could not find something that shows me how to do this).
How do i set "item" to the last selected item of the listbox? sounds like
listbox.get_selectedItem();

in a multi select listbox gets the first selected, not the "last selected".


function onSelectedIndexChanged(sender, args) {
    var listbox = $find("<%= MyListBox.ClientID %>");               
    var items = listbox.get_selectedItems();
 
    if (items.length > 5) {
        // var item = get last selected item ??
        listbox.trackChanges();
        listbox.get_items().remove(item);
        listbox.commitChanges();
         
    }
Paul J
Top achievements
Rank 1
 answered on 18 Jul 2011
6 answers
243 views
Hi

I have a grid with multi-row in-line edit that uses a command item template for edit/update/cancel.  When edit is selected all rows are put into edit mode with just the far right of many columns being editable.  This work fine, but I am wondering if there is a way to indicate which row is being edited so the user can easily folllow the row back to the columns on the left as they are doing data entry?  I would like to change the background or add some kind of indicator on each side of the grid indicating the row currently being edited.  Is this possible?

Thanks,
Gerald
Gerald
Top achievements
Rank 1
 answered on 18 Jul 2011
1 answer
64 views
I am working on putting together a proof of concept to provide an excel-like grid where the user can enter in all of the information first, add as many rows as needed, then save, etc. I have a prototype of that now, but there are two columns which allow large text entries. So when a user is typing in the grid and tabbing through, for basic fields (small text fields, numeric, dates, etc) this is fine, but when they get to the large text fields, they need more real-estate to view and enter data and would like to use the HTML Editor. Using the HTMLEditor in place doesn't look so nice, distorts the rows and columns, and they can't tab out of it to the next field. I would rather provide a link or button which will then popup an HTMLEditor (similar to Edit mode being set to popup, but only for those fields, and if the user hits the link/button to do so, either by clicking or hitting the Enter key when focus is on it).  Can this be done, and if so, what would be the best approach to handle this scenario?
Lori
Top achievements
Rank 1
 answered on 18 Jul 2011
2 answers
98 views
One of the things I've noticed in the help is the ability to expand or collapse a section. This feature is also very useful for our apps. Attached, you can see two pics showing open and close.
Which Telerik control is used to create these container with +, - to open/close?
Thanks!
..Ben
Ben Hayat
Top achievements
Rank 2
 answered on 18 Jul 2011
6 answers
190 views
Hi;
I just installed the new skin by copying it to my Bin and reference it from my project. However, if you go to the skin manger Smart tag, the list does not show in the dropdown list. But in other controls, you can see the new skins in the dropdown.
I'm including two screen shots.
..Ben
Ben Hayat
Top achievements
Rank 2
 answered on 18 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?