Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
157 views
Hello!

I have a problem with a listview.

Let me detail a little more:

I have 1 listview, 1 objectdatasource and 2 SQLDatasources..

First the listeview is binded with objectdatasource.
What i want to do after and really don't know how is:

At OnItemDataBound Event, i want to Add, fields( to fill fields actually) from the 2 SQLDatasources.

The 2 SQLDataSources should use as a parameter(ID for the sql query) an item from the listview.

So at OnItemDataBound, i should take the ObjectID pass it to the SQLDataSources, and complete the fields in the listview


<telerik:RadListView ID="RadListView1" runat="server" DataSourceID="ObjectDataSource1" 
            ItemPlaceholderID="ListViewContainer" DataKeyNames="ObjectID" AllowPaging="True" OnItemDataBound="Get_rest" > 
            <LayoutTemplate> 
                <asp:PlaceHolder runat="server" id="ListViewContainer" /> 
            </LayoutTemplate> 
            <ItemTemplate> 
                <fieldset style="float: left; width: 350px; height: 250px;"
                    <legend style="font-weight: normal"><b>Company Name</b>
                        <%# Eval("ShortName")%></legend
                    <div class="details"
                        <div class="photo-container"
                            <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("WebImage") %>' 
                                AutoAdjustImageControlSize="false" Width="120px" ToolTip='<%#Eval("Description", "Photo of {0}") %>' 
                                AlternateText='<%#Eval("Description", "Photo of {0}") %>' /> 
                        </div> 
                        <div class="data-container"
 
                            <ul> 
                                
                                <li> 
                                    <label> 
                                        Short name</label> 
                                    <%# Eval("Name")%> 
                                     
                                </li> 
                                <li> 
                                    <label> 
                                        City:</label> 
                                    <%#Eval("City")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        ZIP:</label> 
                                    <%# Eval("ZIP")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        SPR:</label> 
                                    <%#Eval("SPR")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        Country:</label> 
                                    <%#Eval("NationID")%> 
                                </li> 
                                
                                <li> 
                                    <label> 
                                        Telephone:</label> 
                                    <%# Eval("Telephone")%> 
                                </li> 
                                  <li> 
                                    <label> 
                                        Mobile:</label> 
                                    <%# Eval("Mobile")%> 
                                </li> 
                                  <li> 
                                    <label> 
                                        Fax:</label> 
                                    <%# Eval("Fax")%> 
                                </li> 
                                  <li> 
                                    <label> 
                                        E-mail:</label> 
                                    <%# Eval("Email")%> 
                                </li> 
                                  <li style="display:none;"
                                     <label id="ObjID_test" runat="server" style="display:none;"
                                       <%# Eval("ObjectID")%> </label> 
                                </li> 
                                 
                                 
                            </ul> 
                        </div> 
                    </div> 
                </fieldset> 
            </ItemTemplate> 
        </telerik:RadListView> 
This is how the Listview looks like. the Objects datasource brings back: Image/Shortname/Name, one sql datasource brings back addresses and the other brings back contact types.
What i managed to do so far is to get the ID at the OnItemDatabound event. After this i am a little stuck, as i don't know what to do next.

Having to use 1 objectdatasource and 2 sqlDatasources is mandatory.



I have a little update on my solution, but it's still not working, and i don't know how ti fix it.

the aspx code looks like this now:

<telerik:RadListView ID="RadListView1" runat="server" DataSourceID="ObjectDataSource1" 
            ItemPlaceholderID="ListViewContainer" DataKeyNames="ObjectID" AllowPaging="True" OnItemDataBound="Get_rest" > 
            <LayoutTemplate> 
                <asp:PlaceHolder runat="server" id="ListViewContainer" /> 
            </LayoutTemplate> 
            <ItemTemplate> 
                <fieldset style="float: left; width: 350px; height: 250px;"
                    <legend style="font-weight: normal"><b>Company Name</b>
                        <%# Eval("ShortName")%></legend
                    <div class="details"
                        <div class="photo-container"
                            <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("WebImage") %>' 
                                AutoAdjustImageControlSize="false" Width="120px" ToolTip='<%#Eval("Description", "Photo of {0}") %>' 
                                AlternateText='<%#Eval("Description", "Photo of {0}") %>' /> 
                        </div> 
                        <div class="data-container"
                                                  <ul> 
                                
                                <li> 
                                    <label> 
                                        Short name:</label> 
                                    <%# Eval("Name")%> 
                                     
                                </li> 
                                 
                               <telerik:RadListView ID="RadListView2" runat="server" DataSourceID="SqlDataSource1" 
            ItemPlaceholderID="ListViewContainer" AllowPaging="True" > 
            <LayoutTemplate> 
                <asp:PlaceHolder runat="server" id="ListViewContainer" /> 
            </LayoutTemplate> 
            <ItemTemplate> 
               <%-- <fieldset>--%> 
                    
                         <li> 
                                    <label> 
                                        City:</label> 
                                    <%#Eval("City")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        ZIP:</label> 
                                    <%# Eval("ZIP")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        SPR:</label> 
                                         
                                    <%#Eval("SPR")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        Country:</label> 
                                    <%#Eval("NationID")%> 
                                </li> 
                             
                             
                                 
                           
                         
              <%--  </fieldset>--%> 
            </ItemTemplate> 
        </telerik:RadListView> 
                                
                                <telerik:RadListView ID="RadListView3" runat="server" DataSourceID="SqlDataSource2" 
            ItemPlaceholderID="ListViewContainer" AllowPaging="True" > 
            <LayoutTemplate> 
                <asp:PlaceHolder runat="server" id="ListViewContainer" /> 
            </LayoutTemplate> 
            <ItemTemplate> 
             
               <%-- <fieldset>--%> 
                    
                           <li> 
                                    <label> 
                                        Phone:</label> 
                                    <%# Eval("Telephone")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        Mobile:</label> 
                                    <%# Eval("Mobile")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        FAX:</label> 
                                    <%# Eval("FAX")%> 
                                </li> 
                                <li> 
                                    <label> 
                                        E-mail:</label> 
                                    <%# Eval("Email")%> 
                                </li> 
              <%--  </fieldset>--%> 
            </ItemTemplate> 
        </telerik:RadListView> 
                                                                 
                            </ul> 
                        </div> 
                    </div> 
                </fieldset> 
            </ItemTemplate> 
        </telerik:RadListView> 

and in code behind i have the onitemdatabound function:

Protected Sub Get_rest(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadListViewItemEventArgs) Handles RadListView1.ItemDataBound 
        Dim ObjID As New Integer 
        'Dim RadListColumn As New Telerik.Web.UI.RadListViewDataItemCollection 
 
 
        Dim item = TryCast(e.Item, RadListViewDataItem) 
        If item IsNot Nothing Then 
            Dim value = CInt(DataBinder.Eval(item.DataItem, "ObjectID")) 
            ObjID = value 
        End If 
        SqlDataSource1.SelectParameters("ObjectID").DefaultValue = ObjID 
        SqlDataSource2.SelectParameters("ObjectID").DefaultValue = ObjID 
 
 
 
    End Sub 

Now the problem is that all the items in the listview, have the address and the contacts of the last  ObjectID.

Ideea anyone?




Rosen
Telerik team
 answered on 01 Jul 2010
1 answer
286 views
There is really no documentation to speak of on the Radgrid OnGroupExanded and OnGroupCollapsed client events so I'm hoping I can get some help from the community.

Scenario: I have Client Side Grouping set on a grid and I need to be able to persist what groups were expanded/collapsed between rebinds so I can't use server side itemcommand event because nothing fires sever side when you use client side grouping.

Approach: I am attaching two javascript functions to handle the two different events and fire a ajaxRequest to the server side with the index of the row expanded/collapsed. I have all the server side hash tables set up based on a forum example and will use the grid.item[itemIndex].expanded = true or false to rehydrate on page load.

Problem: I don't know how to get anything from the two client events to determine what item index was expanded/collapsed. The eventArgs are supposed to be a gridDataItem object but I've had no success accessing properties.

Question: How do I get the index of the expanded/collapsed row client side? See below javascript function.

function

 

CollapseGroup(sender, eventArgs) {

 

var itemIndex = eventArgs (what to do here?)

 

 

$find(

 

"ctl00_RadAjaxManager1").ajaxRequest("Collapsed~" + itemIndex);

 

}

 

Rosen
Telerik team
 answered on 01 Jul 2010
3 answers
97 views
Hi,

I'm initializing the editor via:
    <telerik:RadEditor ID="Editor" runat="server" StripFormattingOptions="Font, Span, Css, MSWordRemoveAll" OnClientPasteHtml="OnClientPasteHtml" Width="100%" OnClientModeChange="OnClientModeChange" OnClientCommandExecuting="OnClientCommandExecuting"/>

In source code view I see:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title></title>
    </head>
    <body>


<!-- content -->
    </body>
</html>

I would only like to see <!-- content --> in source code view.
I am not using templatemanager - mentioning that because I saw some discussion about this similar topic and it seemed to be related to templatemanager.

Thanks.







Rumen
Telerik team
 answered on 01 Jul 2010
1 answer
121 views
Hello,

Is there any trick to make rad window support multiple monitors. I know that it interally uses iframe but it opens up new page from the container page. Any tip is apprecited.

Regards
Mac
Georgi Tunev
Telerik team
 answered on 01 Jul 2010
1 answer
292 views
UPDATE: I've found the problem.
I can't $find the RadMenu control until page is done rendering. 
================================================================
Hello, I'm having trouble with using $find in client-side javascript to get a reference of a RadMenu
$find returns null while $get returns an object.
However, the object $get returned doesn't support .findItemByValue() method.
I'm using Q1 2010 Net4 version with VS2010 and web.config set to .NET 4.

I've also tried $find("RadMenu1");

What kind of dependencies are there for RadMenu? web.config settings?
Thanks.
Gibson

See code below:

var menu = $find("RadMenu1"); 
var item = menu.findItemByText("Message Center"); 
 
Krishnaprabhuraja
Top achievements
Rank 1
 answered on 01 Jul 2010
1 answer
688 views
Is there a way to change the Label property via javascript.

 

 

 

<telerik:RadTextBox Width="300px" ID="txtUrl" runat="server" Label="Url: " 
 
EmptyMessage="please type url here" InvalidStyleDuration="100" > 
 
</telerik:RadTextBox> 
 

Depending on what has been selected in a combobox I want to chnage the label from Url: to something else

 

    var txtUrlInputID = $telerik.$("[id$='txtUrl']").attr("id");  
    var txtUrlInput = $find(txtUrlInputID);  
    txtUrlInput.set_emptyMessage('Please type Email here');  
    txtUrlInput.set_value("")  
 
//I would like to set label as well. I know the below does not exist but can I do it another way.  
//txtUrlInput.set_label("Email: ") 

 

Dimo
Telerik team
 answered on 01 Jul 2010
1 answer
150 views
I have a radgrid that uses an EditTemplate for the purposes of updating the data. For my Datasource i am using an objectdatasource. At runtime when i go to edit a record, the edit panel loads the data is populated correctly, but when i click update and try to save the changes i have made, the EditTemplate is not hooked up to my ObjectDataSource.

Any Ideas?

<telerik:RadGrid ID="rgTimeSheetGrid"  
    runat="server"  
    CssClass="RadGrid"  
    GridLines="None"  
    AllowPaging="True"  
    PageSize="20"  
    AutoGenerateColumns="False"  
    AllowAutomaticDeletes="True" 
    AllowAutomaticInserts="True" 
    AllowAutomaticUpdates="True" 
    DataSourceID="TaskDataSource"  
    ShowStatusBar="True"  
    AutoGenerateEditColumn="True" 
    AutoGenerateDeleteColumn="True" 
    OnItemDataBound="radTimesheetEntry_ItemDataBound" 
    OnItemUpdated="radTimesheetEntry_OnItemUpdated"
    <HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu> 
 
    <MasterTableView 
        DataSourceID="TaskDataSource"  
        ShowGroupFooter="true"  
        CommandItemDisplay="Top"  
        EditMode="EditForms"  
        DataKeyNames="ID" 
        RowIndicatorColumn-HeaderStyle-Width="20px"  
        ExpandCollapseColumn-HeaderStyle-Width="20px"
        <GroupByExpressions> 
            <telerik:GridGroupByExpression> 
                <SelectFields> 
                    <telerik:GridGroupByField FieldAlias="Date" FieldName="Date"></telerik:GridGroupByField> 
                </SelectFields> 
                <GroupByFields> 
                    <telerik:GridGroupByField FieldName="Date" SortOrder="None"></telerik:GridGroupByField> 
                </GroupByFields> 
            </telerik:GridGroupByExpression> 
        </GroupByExpressions> 
        <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
        </ExpandCollapseColumn> 
        <Columns> 
            <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" SortExpression="ID" UniqueName="ID" Visible="false" /> 
            <telerik:GridBoundColumn DataField="Date" HeaderText="Date" SortExpression="Date" UniqueName="Date" Visible="false" /> 
            <telerik:GridBoundColumn DataField="Project" HeaderText="Project" SortExpression="Project" UniqueName="Project" /> 
            <telerik:GridBoundColumn DataField="Activity" HeaderText="Activity" SortExpression="Activity" UniqueName="Activity" /> 
            <telerik:GridBoundColumn DataField="Role" HeaderText="Role" SortExpression="Role" UniqueName="Role" /> 
            <telerik:GridBoundColumn DataField="Notes" Visible="false" HeaderText="Notes" SortExpression="Notes" UniqueName="Notes" /> 
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description" UniqueName="Description" /> 
            <telerik:GridBoundColumn DataField="Hours" DataType="System.Double" HeaderText="Hours" SortExpression="Hours" UniqueName="Hours" /> 
        </Columns> 
        <CommandItemTemplate> 
            <asp:LinkButton ID="lnkAddEntry" runat="server" CommandName="InitInsert">Add Entry</asp:LinkButton> 
        </CommandItemTemplate> 
        <EditFormSettings EditFormType="Template"
            <FormTemplate> 
                <table id="ManageRecord" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none" 
                    style="border-collapse: collapse; background: white;"
                    <tr> 
                        <td> 
                            <table id="ManageLeft" cellspacing="1" cellpadding="1" width="250" border="0" class="module"
                                <tr> 
                                    <td>Project</td> 
                                    <td><asp:DropDownList id="ddProject" runat="server"></asp:DropDownList></td
                                </tr> 
                                <tr> 
                                    <td>Activity</td> 
                                    <td><asp:DropDownList id="ddActivity" runat="server"></asp:DropDownList></td
                                </tr> 
                                <tr> 
                                    <td>Role</td> 
                                    <td><asp:DropDownList id="ddRole" runat="server"></asp:DropDownList></td
                                </tr> 
                                <tr> 
                                    <td>Date</td> 
                                    <td><asp:DropDownList ID="ddDate" runat="server"></asp:DropDownList></td
                                </tr> 
 
                            </table> 
                        </td> 
                        <td> 
                            <table id="ManageRight" cellspacing="1" cellpadding="1" width="250" border="0" class="module"
                                <tr> 
                                    <td>Hours</td> 
                                    <td><asp:TextBox ID="txtHours" runat="server" ></asp:TextBox></td
                                </tr> 
                                <tr> 
                                    <td>Note</td> 
                                    <td><asp:TextBox ID="txtNotes" runat="server" ></asp:TextBox></td
                                </tr> 
                                <tr> 
                                    <td>Description</td> 
                                    <td><asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" ></asp:TextBox></td
                                </tr> 
                            </table> 
                        </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>&nbsp; 
                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> 
                        </td> 
                    </tr> 
                </table> 
            </FormTemplate> 
        </EditFormSettings>   
    </MasterTableView> 
    <ClientSettings> 
        <ClientEvents OnRowDblClick="RowDblClick" /> 
    </ClientSettings> 
</telerik:RadGrid> 
<asp:ObjectDataSource ID="TaskDataSource" runat="server"  
    DeleteMethod="Delete" InsertMethod="Create" SelectMethod="Select"  
    TypeName="T4G.TIM.Web.Data.TaskController" UpdateMethod="Update" > 
    <DeleteParameters> 
        <asp:Parameter Name="ID" Type="Int32" /> 
        <asp:Parameter Name="Project" Type="String" /> 
        <asp:Parameter Name="Activity" Type="String" /> 
        <asp:Parameter Name="Role" Type="String" /> 
        <asp:Parameter Name="Hours" Type="Double" /> 
        <asp:Parameter Name="Notes" Type="String" /> 
        <asp:Parameter Name="Description" Type="String" /> 
        <asp:Parameter Name="Date" Type="String" /> 
    </DeleteParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="ID" Type="Int32" /> 
        <asp:Parameter Name="Project" Type="String" /> 
        <asp:Parameter Name="Activity" Type="String" /> 
        <asp:Parameter Name="Role" Type="String" /> 
        <asp:Parameter Name="Hours" Type="Double" /> 
        <asp:Parameter Name="Notes" Type="String" /> 
        <asp:Parameter Name="Description" Type="String" /> 
        <asp:Parameter Name="Date" Type="String" /> 
    </UpdateParameters> 
    <InsertParameters> 
        <asp:Parameter Name="ID" Type="Int32" /> 
        <asp:Parameter Name="Project" Type="String" /> 
        <asp:Parameter Name="Activity" Type="String" /> 
        <asp:Parameter Name="Role" Type="String" /> 
        <asp:Parameter Name="Hours" Type="Double" /> 
        <asp:Parameter Name="Notes" Type="String" /> 
        <asp:Parameter Name="Description" Type="String" /> 
        <asp:Parameter Name="Date" Type="String" /> 
    </InsertParameters> 
</asp:ObjectDataSource> 

Martin
Telerik team
 answered on 01 Jul 2010
1 answer
171 views
Hello!

I have a problem with Server.Transfer.

I have a asp:menu and asp:multiview and inside one multiview is a button wich should Server.Transfer to other page.

I have ajaxified the menu with:
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
         <AjaxSettings>               
            <telerik:AjaxSetting AjaxControlID="Menu1">
             <UpdatedControls>
               <telerik:AjaxUpdatedControl ControlID="MultiView1"/>
             </UpdatedControls>
            </telerik:AjaxSetting>
         </AjaxSettings>
</telerik:RadAjaxManagerProxy>

Everything works fine.

Now I noticed that if I want to Server.Transfer within the menu with a button it's not working. It fires the correct page but does not shows. If I put it outside the Menu everything works fine!

What can I do??
Sebastian
Telerik team
 answered on 01 Jul 2010
1 answer
131 views
What I want to do is this. When i open a new radwindow, a new window will appear with a tab that contains the page I opened. When I open another window. instead of a new window will appear, i want a new tab that contains the page i just opened   to be added to the previous window. Everytime I open a new window, It will just be added as a tab.




Yana
Telerik team
 answered on 01 Jul 2010
4 answers
146 views
Hello,

I am running RadEditor for Sharepoint version with 5.6.2.0 assembly and have enabled multiingual dictionaries (by editing the ToolsFile.xml) for the spell checker.
The functionality works fine for the first Telerik RadEditor control on the page in authoring mode (see attached screenshot radHtml1.jpg), however if on all the subsquent RadEditor controls, the language selection dropdown for the Spell checker is blank. (see radHtml2.jpg

Is this a bug in the control ? or am I doing something wrong.

Thanks.

 

Stanimir
Telerik team
 answered on 01 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?