Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
55 views
Hi,

I am using radgrid and in itemtempalte I have a dropdownlist and a label control. OnItemDatabound event I am passing the ids of dropdownlist and a label control to a javascript function. The functions finds the client ids of the dropdownlist and a label control but when I use document.getElementbyId for label control it gives me null.

Any help would be really appreciated.

Thanks



function OnSelectedIndexChange(ddlTopic, lblTopic) {
 
       alert(ddlTopic);
       alert(lblTopic);
       var ddl = document.getElementById(ddlTopic);
       var lbl = document.getElementById(lblTopic); // The problem occurs here 
       alert(lbl);  
       ddl.style.display = "none";       
        
 
   }
 
 
 
 
<telerik:RadGrid ID="gvTopics" runat="server" Font-Names="Verdana" Font-Size="XX-Small"
                   Skin="Outlook" EnableEmbeddedSkins="true" GridLines="Vertical" AllowSorting="true"
                   AllowPaging="true" Width="99%" CellPadding="2" AutoGenerateColumns="False">
                   <MasterTableView CommandItemDisplay="Top">
                       <CommandItemSettings ShowAddNewRecordButton="false" />
                       <Columns>
<telerik:GridTemplateColumn SortExpression="Topic" HeaderText="Topic">
                               <ItemTemplate>
                                   <asp:LinkButton ID="lnkTopic" Text='<%# Bind("Topic") %>' runat="server"></asp:LinkButton>
                                   <telerik:RadToolTip ID="rttpTopics" Width="350" Height="100" HideEvent="ManualClose"
                                       TargetControlID="lnkTopic" RelativeTo="Element" Skin="Windows7" Position="TopRight"
                                       ManualClose="true" ShowEvent="OnClick" runat="server">
                                       <table width="100%">
                                           <tr>
                                               <td width="40%">
                                                   select topic :
                                               </td>
                                               <td>
                                                   <asp:DropDownList ID="ddlTopic" runat="server" Font-Names="Verdana" Font-Size="XX-Small"
                                                       ValidationGroup="selecttopic" AutoPostBack="false" />
                                                    <asp:RequiredFieldValidator ID="rfvTopic" runat="server" ErrorMessage="## please select a topic"
                                                       InitialValue="- please select -" ControlToValidate="ddlTopic" Font-Bold="True"
                                                       Font-Names="Arial" Font-Size="X-Small" SetFocusOnError="True" ValidationGroup="selecttopic" />
                                                   <telerik:RadTextBox ID="rtbTopicName" EmptyMessage="please enter topic name"
                                                       runat="server">
                                                   </telerik:RadTextBox>
                                                   <asp:Label ID="lblTopicName" Text="TopicName" Visible="false" runat="server"></asp:Label>
                                               </td>
                                           </tr>
                                           <tr>
                                               <td>
                                               </td>
                                               <td>
                                                   <asp:Button ID="btnSaveTopic" CommandArgument='<%# Container.DataItem("id")%>' ValidationGroup="selecttopic"
                                                       CausesValidation="true" OnClick="btnSaveTopic_Click" Text="Save" runat="server" />
                                               </td>
                                           </tr>
                                       </table>
                                   </telerik:RadToolTip>
                               </ItemTemplate>
                           </telerik:GridTemplateColumn>
</Columns>
                       <NoRecordsTemplate>
                           <asp:Label ID="Label5" runat="server" Text="no topics found"></asp:Label>
                       </NoRecordsTemplate>
                   </MasterTableView>
               </telerik:RadGrid>
 
 
 
Protected Sub gvTopics_OnItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles gvTopics.ItemDataBound
 
       If TypeOf (e.Item) Is GridDataItem Then
 
           Dim ddlTopic As DropDownList = e.Item.FindControl("ddlTopic")
           Dim lblTopicName As Label = e.Item.FindControl("lblTopicName")
           ddlTopic.Attributes.Add("onChange", "return OnSelectedIndexChange('" & ddlTopic.ClientID & "','" & lblTopicName.ClientID & "');")
 
   End Sub
Shinu
Top achievements
Rank 2
 answered on 22 Aug 2012
2 answers
70 views
Hi,

I need a help regarding the Read menu with WCF and radgrid. 

I have a red grid with template column. In Template column there is a RedMenu. That rad menu items will be desided (when expand get from WCF service) . I followed the link below. It worked well.  

http://www.telerik.com/help/aspnet-ajax/menu-items-wcf-service.html.

But in my case I need to pass data from the row in DataGrid to WCF service. For example will assume grid containes Order details and column with "Order Number". I need to pass the "Order Number" to the WCF method as done in above sample.

sample has done this using js method as follows.

function OnClientItemPopulatingHandler(sender, e) 
    {        
        var context = e.get_context();
        //using jQuery to get the checked item and pass it to the server        
        context["ProductSuite"] = $telerik.$("input[name='rblSuites']:checked").val();
    }

I need to do this as follows

function OnClientItemPopulatingHandler(sender, e) 
    {        
        var context = e.get_context();
        //using jQuery to get the checked item and pass it to the server        
        context["OrderNumber"] = GET THE ORDER NUMBER FROM ROW BELONGS TO THE RADMENU.
    }

can anybody help me to resolve this ?

Thank you
Dinesh
Top achievements
Rank 1
 answered on 22 Aug 2012
1 answer
38 views
Good afternoon friends of telerik! I am new in the area of programming ... and I would like an example (code) how can I do to select the lines of my RadGrid via a Checkbox ...



Thank you for the attention!

Shinu
Top achievements
Rank 2
 answered on 22 Aug 2012
3 answers
185 views
How to set css for the radbutton so that it is displayed as image?
Princy
Top achievements
Rank 2
 answered on 22 Aug 2012
2 answers
125 views
Hi, 

I've just published a website I've developed (using Visual Studion 2010 using .NET 4.0) in my IIS Server. I have two pages I'm testing: the Login page which does not contain any Telerik controls and another page to which I am directed after logging in. This second page now contains Telerik controls.

Unfortunately, the page is not rendered at all and I'm getting this error instead. 

An unhandled exception occured...

Error Message: Object reference not set to an instance of an object.
Stack Trace: at Telerik.Web.UI.ScriptEntrySlot.GetSerializedAssemblyInfo(ScriptEntry scriptEntry) at Telerik.Web.UI.ScriptEntryUrlBuilder.TryAddScriptEntry(ScriptEntry scriptEntry) at Telerik.Web.UI.ScriptEntryUrlBuilder.RegisterScriptEntry(ScriptEntry scriptEntry) at System.Web.UI.ScriptManager.RegisterScripts() at System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Is there something you could suggest that I could check or change?
Daryl
Top achievements
Rank 1
 answered on 22 Aug 2012
6 answers
62 views
Hi

I am using PanelBar as a 2-level menu, and have set ExpandMode="SingleExpandedItem"  PersistStateInCookie="True" and this works as expected.

However, I would like to have the open item close when the user clicks another top level menu item even if the clicked item does NOT have any child items in it. 

How can I achieve this behaviour?  Can someone help with this?  

I need to achieve this because I realize after user testing that it is the user expectation!

Thanks

Clive
Clive Hoggar
Top achievements
Rank 1
 answered on 21 Aug 2012
3 answers
137 views
Hi all,
I am trying to use radlistbox with ajax listsearch extender but it is giving error like
"

Extender control 'ajaxListSearchExtender' cannot extend 'RadListBoxSource'. Extender controls of type 'AjaxControlToolkit.ListSearchExtender' cannot extend controls of type 'Telerik.Web.UI.RadListBox'.

"
how can i do this...

i have 500 items in listbox i want to do listsearch...
help me...
Joseph
Top achievements
Rank 1
 answered on 21 Aug 2012
2 answers
233 views
Hi, all.
A bit new to web development but not new to software development.
Web application is using Telerik grid and upload controls. Everything is working as expected on development machine.
How it was deployed on the server: copied everything including bin folder to the server. Telerik.Web.UI.dll is there. File version-2011.1.315.40. Product version -2011.1.315.40.
Checked app pools, frameworks are same for app pool and for web application.
When started on the server I am getting to login screen OK. Login screen is passed to next screen that is using Telerik control and there I am keep getting "Could not load file or assembly 'Telerik.Web.UI, Version=2011.1.315.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The system cannot find the file specified."

Thank you,
Alex.
Alex
Top achievements
Rank 1
 answered on 21 Aug 2012
1 answer
87 views
Is it possible to make it so that when the RibbonBar is in the minimized mode and tabs are accessed that the menu content is shown above other content on the page to avoid everything getting pushed down??
Adam Nelson
Top achievements
Rank 2
 answered on 21 Aug 2012
4 answers
1.2K+ views
OK, I have a radgrid with a GridButtonColumn (below)
<telerik:RadGrid ID="grdOrderedItems" OnNeedDataSource="OrdItem_NeedDataSource"
    OnItemDataBound="OrdItemDatabound" runat="server" AutoGenerateColumns="False" AllowPaging="False">
    <ClientSettings>
        <Scrolling AllowScroll="True" ScrollHeight="250px" UseStaticHeaders="True"></Scrolling>
    </ClientSettings>
    <MasterTableView NoMasterRecordsText="You have no ordered items att his time.">
        <Columns>
            <telerik:GridBoundColumn HeaderText="Order Number" DataField="OrderNumber"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Item Number" DataField="ItemNumber"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Item Name" DataField="ItemName"></telerik:GridBoundColumn>
            <telerik:GridButtonColumn HeaderText="View Custom Print" UniqueName="btnView" DataTextField="CustomID"></telerik:GridButtonColumn>
            <telerik:GridBoundColumn HeaderText="Custom ID" DataField="CustomID" Visible="False"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Friendly Name" DataField="FriendlyName" Visible="False"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Ordered By" DataField="OrderedBy"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn HeaderText="Shipped?" DataField="Shipped"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

I want to have an onclick event with a command argument
I kind of have it - but this line
                     btnView.Attributes.Add("OnClick", "LoadProof(null, null)"); 
gives me some issues...
protected void OrdItemDatabound(object sender, GridItemEventArgs e)
{
    if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem itemValue = (GridDataItem)e.Item;
 
            LinkButton btnView = (LinkButton)itemValue["btnView"].Controls[0];
            btnView.Attributes.Add("OnClick", "LoadProof(null, null)");
            btnView.CommandArgument = string.Format("return Click('{0}';", itemValue.GetDataKeyValue("CustomID"));
        }
    }
}

I need to fire this block of code:
protected void LoadProof(object sender, EventArgs e)
{
    //.... do some stuff
}

But I can't figure out how to call the object and arguments - for the onclick:
btnView.Attributes.Add("OnClick", "LoadProof(null, null)");
Any suggestions?  I know, it shouldn't be "null, null" - but I can't use "sender, e" - Visual Studio doesn't like it.
Mark
Top achievements
Rank 1
 answered on 21 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?