Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
274 views
I've got a question regarding the Telerik RadGrid control client side binding. I want to populate grid with the cities on the Client Side. I've got a object City, which has a property Country: 

[DataContract]
[KnownType(typeof(Country))]
public class City
{
    [DataMember]
    public virtual string CityCode { get; set; }
 
    [DataMember]
    public virtual string CityName { get; set; }
 
    [DataMember]}
    public virtual Country Country      {  get; set;           
    }
}
 
[DataContract]
public class Country
{
    [DataMember]
    public virtual string CountryCode { get; set; }
    [DataMember]
    public virtual string Iso2Code { get; set; }
    [DataMember]
    public virtual string CountryName { get; set; }
    [DataMember]
    public virtual char RDC { get; set; }
 
}

I retrieve this data as a JSON object to the client side using the JQuery Ajax and WCF. and then I bind it to the grid: 

rgCity.set_dataSource(dataItem);
rgCity.dataBind();
Here are the Columns definition for the grid: 

<Columns>
    <telerik:GridBoundColumn HeaderText="City Code" DataField="CityCode" MaxLength="3">     </telerik:GridBoundColumn>
    <telerik:GridBoundColumn HeaderText="City Name" DataField="CityName"></telerik:GridBoundColumn>
    <telerik:GridBoundColumn HeaderText="Country Code" DataField="CountryCode" MaxLength="2"></telerik:GridBoundColumn>
</Columns>
The problem is I'm not getting the Country Code column populated with the data. I think the problem is in data binding, but I'm not sure if is it possible to bind a complex objects. I think should be something like that: 
<telerik:GridBoundColumn HeaderText="Country Code" DataField="City.CountryCode" MaxLength="2"></telerik:GridBoundColumn>

I appreciate any help solving that issue! 



Radoslav
Telerik team
 answered on 16 Nov 2012
1 answer
61 views
HI,

I have a page with 3 radgrids.Each exactly the same.

The first grid gives me a value in the SelectedValue property when a row is selected. The second grid, is an exact copy of the first grid does not give a value in the selectedvalue property.

My code on postback:

        If Page.IsPostBack = True Then
            'CLick on Branch 
            If CType(Request.Form("__EVENTTARGET"), String) = "eStatsDetail1$RadGrid1" Then
                Dim BranchNameString As String
                BranchNameString = RadGrid1.SelectedValue
                Session("BRANCHNAME") = RadGrid1.SelectedValue
                SqlDataSource2.SelectParameters("@P_BRANCHNAME") = New Web.UI.WebControls.Parameter("@P_BRANCHNAME", DbType.String, BranchNameString)
                RadGrid4.Rebind()
            End If


            'User Clicks on Employee
            If CType(Request.Form("__EVENTTARGET"), String) = "eStatsDetail1$RadGrid4" Then
                BindBranchGrid()
                Dim EmployeeNameString As String
                EmployeeNameString = RadGrid4.SelectedValue 'This is always empty
                Session("EMPLOYEENAME") = RadGrid4.SelectedValue
                SqlDataSource4.SelectParameters("@P_EMPLOYEENAME") = New Web.UI.WebControls.Parameter("@P_EMPLOYEENAME", DbType.String, EmployeeNameString)
                RadGrid3.Rebind()
            End If
        End If
Tsvetoslav
Telerik team
 answered on 16 Nov 2012
3 answers
90 views
Hi,

I have RadListboxitems with context menu, after i selected one listboxitem now trying to invoke context menu for another item throws script error says "Microsoft JScript runtime error: 'this._dragSelector' is null or not an object".  Am I missing any properties?

Listbox
-----------------
<telerik:RadListBox runat="server" Skin="Office2010Blue" EnableDragAndDrop="false" ClientIDMode="Static" ID="Listbox"
                        DataTextField="category" DataValueField="categoryid" OnClientContextMenu="showContextMenu" 
                        AllowAutomaticUpdates="false" AllowDelete="false" AllowReorder="false" AllowTransfer="false" SelectionMode="Single"
                            Width="200px" Height="350px" OnClientSelectedIndexChanged = "Listbox_OnClientSelectedIndexChanged">
</telerik:RadListBox>

Contextmenu
------------------------
<telerik:RadContextMenu ID="Contextmenu" runat="server" Skin="Office2010Blue">
                       <Items>
                           <telerik:RadMenuItem Text="Add"></telerik:RadMenuItem>
                           <telerik:RadMenuItem Text="Edit "></telerik:RadMenuItem>
                           <telerik:RadMenuItem Text="Delete"></telerik:RadMenuItem>
                       </Items>
 </telerik:RadContextMenu>


Thanks,
Nagarajan.
Nagarajan
Top achievements
Rank 1
 answered on 16 Nov 2012
3 answers
481 views
I have a Radgrid and its columns are dynamically built at run time as it can have one to six columns.
It also has EditColumn and GridButton column and allowFiltering is set tot True.

I have two questions:

1)The radgrid seems to allocate equal width to each column.
If I try to allocate the width for editcolumn and Gridbutton column, the header/filter row doesnt seem to change accordingly.
How do I align the header/filter row with the rest of the rows?

2) As there are no templates used for columns, the edit buttons are displayed on the left side of the grid.
How can I move them to the right?



Shinu
Top achievements
Rank 2
 answered on 16 Nov 2012
5 answers
551 views
Hello,

I am using AsyncUpload in my project which is "TextBox + Button". I want to hide the TextBox. It means I want only SELECT Button visible for browsing the file, instead of "TextBox + Button". How does I make work?


Thanks in Advance.
Princy
Top achievements
Rank 2
 answered on 16 Nov 2012
1 answer
331 views
I have code for an asp.net link button
<asp:LinkButton ID="LinkButton4" runat="server" Text="Copy To Clipboard" OnCommand="LinkButton4_Command"
        OnClientClick="CopyToClipboard();"></asp:LinkButton>
I want to use it in a rad menu that I created when the user clicks on its menu item

<telerik:RadMenu runat="server" ID="AssociateMenu" Skin="Windows7" Width="200px"
      Flow="Vertical" EnableAutoScroll="False">
      <Items>
          <telerik:RadMenuItem ID="AddAssociateMenuItem" runat="server" Text="Add Associate"
              NavigateUrl="~/Add_Associate.aspx" />
          <telerik:RadMenuItem ID="ManageUserMenuItem" runat="server" Text="Manage User Account"
              NavigateUrl="~/Create_User.aspx" />
          <telerik:RadMenuItem ID="DeactivateAssociateMenuItem" runat="server" Text="Deactivate Associate"
              NavigateUrl="~/Deactivate_Associate.aspx" />
               <telerik:RadMenuItem ID="CopyClipboardMenuItem" runat="server" Text="Copy To Clipboard"
              PostBack="False" />
                <telerik:RadMenuItem ID="PrintLabelMenuItem" runat="server" Text="Print Mailing Label"
              PostBack="False" />
               
      </Items>
  </telerik:RadMenu>

i want client side code to run for the CopyClipboardMenuItem and PrintLabelMenuItem

function CopyToClipboard() {
                   //RadPageView pv = (RadPageView)this.FindControl("RadPageView1");
 
                   //UserControl uc = (UserControl)pv.FindControl("UserControl1");
                   var textboxVal = $get("<%= txtCopy.ClientID%>").value;
                   //var textboxVal = ((TextBox)pc.FindControl("txtCopy")).Text.Trim();
                   // var textboxVal = document.getElementById("txtCopy").value;
                   if (window.clipboardData && clipboardData.setData) {
                       clipboardData.setData("Text", textboxVal);
                       alert("item successfully copy to Clipboard");
                   }
                   else {
                       alert("works only in IE4+");
                   }
               }


function printLabel() {
                    // alert('test4');
                    //  jQuery.lightbox({ href: "#dialog3" });
                    jQuery.colorbox({ innerWidth: "390", innerHeight: "210", opacity: .85, inline: true, overlayClose: false, transition: "fade", speed: 1500, href: "#dialog3" });
 
                }

The code works when I use a linkbutton

<asp:LinkButton ID="LinkButton4" runat="server" Text="Copy To Clipboard"
OnCommand="LinkButton4_Command"
        OnClientClick="CopyToClipboard();"></asp:LinkButton>
    </br>
    <asp:LinkButton ID="LinkButton2" runat="server" Text="Print Mailing Label"
OnCommand="LinkButton2_Command"
        OnClientClick="printLabel(); return false;" AutoPostBack="false"></asp:LinkButton>

Is there a way to do this I have not found a solution that works. Thanks in advance for any help.
Princy
Top achievements
Rank 2
 answered on 16 Nov 2012
3 answers
253 views
[Correct title of the post] - Click a button on press of enter key

Hi Folks,

I have a rad window, which has some text content and 'Yes' & 'No' buttons. [Note, there are no text boxes present].
When the enter button is pressed, the 'Yes' button click must be triggered.

How do I do this?

Regards,
Saravanan
Princy
Top achievements
Rank 2
 answered on 16 Nov 2012
4 answers
207 views
Hopefully, this is a simple request. I just want to make the RadSplitBar a little taller so it is easier for our users to grab when resizing their panes. I tried setting the Height property of the RadSplitBar control, but it doesn't change anything. If I need to do this with css, example code would be greatly appreciated. As you can see by my example, my requirement is to use CollapseMode="Both", so I may need to supply taller images for all these situation as well.

I have attached the screen shot of what it looks like by default, here is the page source.

Thanks,

-Gary

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SplitterTest.aspx.cs" Inherits="WebAppTesting.SplitterTest" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>  
    <div>
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Orientation="Horizontal" >
            <telerik:RadPane ID="RadPane1" runat="server" BackColor="Red">
            </telerik:RadPane>           
            <telerik:RadSplitBar ID="RadSplitBar1" runat="server" CollapseMode="Both" Height="20px">
            </telerik:RadSplitBar>
            <telerik:RadPane ID="RadPane2" runat="server" BackColor="Purple">
            </telerik:RadPane>           
        </telerik:RadSplitter>
    </div>
    </form>
</body>
</html>
Gary
Top achievements
Rank 1
 answered on 15 Nov 2012
4 answers
120 views
Hi,
I have RadAjaxManager control on my master page and 2 RadUpload controls on my content page. Upon postback,I'm getting uploadfiles counts to zero even though I upload files. I know that we can not write files while performing AjaxRequest, so how can I disable Ajax request for this particular page and not for the other pages ?

I have tried following code on my content page but It doesnt work either.
RadAjaxManager AjManager = Master.FindControl("RadAjaxManager1") as RadAjaxManager;
AjManager.EnableAJAX = false;


Thanks

Tejas
Waseem
Top achievements
Rank 1
 answered on 15 Nov 2012
3 answers
136 views
I have a Radgrid with a custom column(rowID) added to it.
The custom column is in hidden mode in the radgrid.
All the columns in the grid are built dynamically at runtime, no template used.
And EditMode = Popup.

While Inserting or Updating rows, the custom column (rowID) is displayed at the top of the EditFormat.
I want to hide the first row which contains the label for custom column and its value.
How can I hide that column and its value?


Krutika
Top achievements
Rank 1
 answered on 15 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?