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

I am trying to set text to radcombobox in radgrid itemtemplate. I am getting an error "object reference not set to an instance of object" at

Box1.Text = Box2.SelectedValue;


ASPX:

<

 

telerik:GridTemplateColumn HeaderText = "Print Letters/Post Cards" UniqueName = "PrintLetter" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">

 

 

<ItemTemplate>

 

 

<telerik:RadComboBox ID= "Print" runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem runat="server" Text=""/>

 

 

<telerik:RadComboBoxItem runat="server" Text="1 Year Postcard"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="1 Year Adult"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="2 Years Adult"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="3 Year"/>

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

</ItemTemplate>

 

 

<EditItemTemplate>

 

 

<telerik:RadComboBox ID= "PrintEdit" runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem runat="server" Text="1 Year Postcard"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="1 Year Adult"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="2 Years Adult"/>

 

 

<telerik:RadComboBoxItem runat="server" Text="3 Year"/>

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

</EditItemTemplate>

 

 

</telerik:GridTemplateColumn>

 


ASPX.CS:

protected

 

void EditGrid(object sender, GridCommandEventArgs e)

 

 

{


GridEditableItem

 

dataItem = e.Item as GridEditableItem;

 


RadComboBox

 

Box1 = e.Item.FindControl("Print") as RadComboBox;

 

RadComboBox

 

Box2 = (RadComboBox)dataItem["PrintLetter"].FindControl("PrintEdit");

 

Box1.Text = Box2.SelectedValue;


}
Princy
Top achievements
Rank 2
 answered on 10 Mar 2011
1 answer
104 views
I had hoped to use some raddocks on my pages w/o any dragging or any dock zones.

I simply wanted to make use of the container UI and the ability to add commands to the title bar easily.

But I am finding that the raddocks all float up to the top as far as they can.  In fact, if I put 2 in the same div an separate them by a few <BR>s the simply display on top of one another.

Is there any way around this?  Or is this not possible to use them in this manner?

EDIT: of course as soon as I post I find a work around.

I can just wrap my raddocks in raddockzones, and I don't have to enable dragging and it seems to do what I want.
Sean
Top achievements
Rank 2
 answered on 10 Mar 2011
1 answer
88 views
Hi Telerik,

I have reviewed the example on how to remove a dynamically created splitbar here. I am trying to remove a RadPane and RadSplitBar from a RadSplitter on collapse.

First, during the OnClientCollapsed event I make an ajaxRequest to force a postback on the page. Then, during SaveDockLayout I perform validation on my controls and remove those controls which need to be removed. 

RadSplitter splitter = splitBarToRemove.Splitter;
splitter.Items.Remove(splitBarToRemove);
RadControlStates.SplitbarStates.Remove(splitBarToRemove.ID);

I do this inside of SaveDockLayout -- which causes an exception to be thrown later on. Presumably, this exception is being caused by the fact that I am modifying the view state (?) during a period in which it should not be modified.

By using the line "splitter.Items.Remove(splitBarToRemove)" I get the message
else{var g=this.getSplitBarByIndex(0);
var e=g.get_element();
 
Uncaught TypeError: Cannot call method 'get_element' of null
off over in a Telerik.Web.UI.WebResource -- the one for the RadSplitter, presumably. Anyway, I remove the code that brings the dynamically created SplitBar back -- so I'm not adding a new SplitBar to the RadSplitter. I've tried just disabling the control. The code doesn't know that the RadSplitBar should be removed until after the ajaxRequest has finished processing as SaveDockLayout needs to fire and an AjaxRequest is necessary to make the postback happen. Any thoughts?
Sean
Top achievements
Rank 2
 answered on 10 Mar 2011
0 answers
105 views
In EnableLoadOnDemand mode, there are some instances where the control fails to perform the dropdown refresh callback. This causes the posted data to be unpredictable when compared to what the user sees or things he has posted.

To reproduce the problem (must be done exactly in this order):
    - type something that pulls up some list items
    - select item from list
    - click on textbox (all text should now be selected)
    - press <End> then <BackSpace>; alternatively selecting a text subset with <Shift-Arrows> and then <Del>; or even <Ctrl-A> and the <Del> 

In all these instances the callback does not occur as it should. 
The problems resulting from this bug are different depending if the MarkFirstMatch is True.

If True, the selected item ID is cleared but the returned Text is different than what is shown.
If False, the ID and Text from a previous callback (before the one that was missed) are returned which is expecialy bad when you have just cleared the dropdown and one is under the impression that nothing is selected.

I think fixing the missed callbacks will fix all these issues.
Bort
Top achievements
Rank 1
 asked on 09 Mar 2011
1 answer
160 views
I am using the combobox in EnableLoadOnDemand mode. The data in the drop down has three collums (ID, Name, Address). I set my default selected item like this:
 
Me.RadComboBox.SelectedValue = "9238"
Me.RadComboBox.Text = "Smith, Jones"

I happen to have 3 "Smith, Jones"  in my database each with different IDs. When I click on the drop down, the control is smart enough to get the 3 smiths matching the text in the dropdown but the selected item in the list is always the first one. The item with the 9238 ID happens to be the third item in the list so the default selection is invalid pointing to the wrong customer confusion my users. Is there a way to get the selected item in the drop down list to match the ID that I have set as the default starting value? It seems to me this should be a default behavior.
Bort
Top achievements
Rank 1
 answered on 09 Mar 2011
1 answer
126 views
Hi,

I have export some data from Telerik Grid to Excel, it's working fine(data are available in excel sheet) but when i open the excel i got an error (Please see). while trying to import the same excel sheet i got an error (External table is not in the expected format.)

Note: The other excel sheet (Not exported from telerik) is working fine while importing

Advance Thanks & Regards,
Bala
Daniel
Telerik team
 answered on 09 Mar 2011
1 answer
93 views
Hello there

I am unable to render the tagcloud in a repeater; it generates the following exception:

Exception type: NullReferenceException

Exception message: Object reference not set to an instance of an object.

at Telerik.Web.UI.RadTagCloud.BindToEnumerableData

I have added some code below to replicate. In this example I have bound the repeater to a simple list.



<%@ Page Language="VB" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script runat="server">
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  
        If Not IsPostBack Then
              
            Dim oDatasource As New List(Of String)
            oDatasource.Add("Item 1")
            oDatasource.Add("Item 2")
            oDatasource.Add("Item 3")
            oDatasource.Add("Item 4")
          
            rp.DataSource = oDatasource
            rp.DataBind()
  
        End If
    End Sub
      
</script>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Repeater ID="rp" runat="server">
            <ItemTemplate>
                <telerik:RadTagCloud ID="RadTagCloud1" runat="server" Width="400px">
                    <Items>
                        <telerik:RadTagCloudItem Text="ASP.NET" Weight="12" />
                        <telerik:RadTagCloudItem Text="AJAX" Weight="134" />
                    </Items>
                </telerik:RadTagCloud>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    </form>
</body>
</html>
Pero
Telerik team
 answered on 09 Mar 2011
1 answer
93 views
Is there anything in the clientside api for adding and removing items?
Pero
Telerik team
 answered on 09 Mar 2011
2 answers
88 views
Hello,
I am using the RadDataPager to page thorugh what is essentially a home-grown control that does not support databinding. Everything works perfectly though and I am able to Page properly, except for changing the size of the page. If I change the size of the page I get the correct page size reflected on the server-side properties. However, the issues comes when I page forward or backwards. The datapager will default to the page size being 10. I understand that the pager uses the get method to move forwards and backwards so I am unable to persist the changed page size in the viewstate. Is there any way to force the pager into using a POST method or is there a way to have the control pass the page size as a querystring variable similar to the SEOPagingQueryPageKey?  Other than this the datapager works beautifully with my non-databound control. I could resort to re-writing the URL once the PageSizeChange event is captured, but am trying to avoid that if possible.

Best Regards,
Mark Fitzpatrick
Mark Fitzpatrick
Top achievements
Rank 1
 answered on 09 Mar 2011
0 answers
97 views
I'm adding  nodes to the treeview at page load. Also at the same time I am adding a Label and a DropDown control to the node.

I want to disable the DropDowns for certain nodes  based on what node was checked. The Error I'm getting is :
"Object reference not set to an instance of an object."

This is because the the TreeView1.Nodes(0).Nodes(i).Count is 0. But it shouldn't be.

Does anyone know what I'm doing wrong here?


Heres how I am creating the nodes:
            For i As Integer = 0 To DsStateDistrictID.Tables(0).Rows.Count - 1
                Dim treeNode As New Telerik.Web.UI.RadTreeNode(DsStateDistrictID.Tables(0).Rows(i).Item("DistrictName").ToString)
                treeNode.Value = DsStateDistrictID.Tables(0).Rows(i).Item("StateDistrictID").ToString
                treeNode.Checkable = True

                'Add Label with StateDistrict Name to Node
                Dim lbl As Label = New Label
                lbl.Text = DsStateDistrictID.Tables(0).Rows(i).Item("DistrictName").ToString
                lbl.ID = "lbl" & DsStateDistrictID.Tables(0).Rows(i).Item("StateDistrictID").ToString.Trim
                treeNode.Controls.Add(lbl)

                'Add Color DropDown to Node
                Dim ddColor As DropDownList = New DropDownList
                ddColor.ID = "dd" '& DsStateDistrictID.Tables(0).Rows(i).Item("StateDistrictID").ToString.Trim
                ddColor = BuildColorDropDown(ddColor)
                treeNode.Controls.Add(ddColor)
                TreeView1.Nodes(0).Nodes.Add(treeNode)


            Next


        End If


Heres how I am trying to disable the drop down list:
For i As Integer = 0 To TreeView1.Nodes(0).Nodes.Count - 1
                    Dim StateDistrictID As String = TreeView1.Nodes(0).Nodes(i).Value.ToString.Trim
                    Dim ddColor As New DropDownList
                    ddColor = CType(TreeView1.Nodes(0).Nodes(i).FindControl("dd" & StateDistrictID), DropDownList)
                    ddColor.Enabled = False
Next
Brad
Top achievements
Rank 1
 asked on 09 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?