Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
115 views
I have a custom object "Person", which has a property "Address", which in turn has a property "City". I bind a grid to a collection of "Person" and have a column for City. I would like to be able to sort by City, but if I try, I get an error stating that the Column "City" cannot be found. I assume this is because the "Person" object doesn't have a property named "City". I can, of course, create a readonly property named City for the Person, but this would pretty much eliminate the purpose of binding to the custom type (as oposed to a dataview, or something along those lines). Is there any way to acoomplish what I am trying to do?
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
 answered on 17 Sep 2008
5 answers
326 views

Hello all, specially Vlad ^_^

I have an issue for you. I encouter a NullPointerException with my grid.
As you will see in provided code, the grid is pretty simple, with EditMode set to /InPlace/, and it allows column sizing ...

I apologize in advance if this issue has already been raised, but I haven't seen related stuff in the existing threads ... except perhaps an old thread concerning an old version of the control with different behavior [ Bizarre Grid Behavior ]

In my case, the Edit/Update process works well, and the sizing process seems to do what it supposed to do as well .. with a little bemol here, but that's not the point of this topic ... The issue appears when you try to mix both, I mean click on Edit and while editing you resize any column .. then after when you try to validate your changes by clicking the Update link .. the exception is raised.

Same result in the opposite way, if you resize a column and after that click on Edit it breaks ... That's seems pretty ugly, because I cannot mix resize and edit ... :-(

At first it was javascript exception : Sys.WebForms.PageRequestManagerServerErrorException : Object reference not set to an instance of an object.

Much interesting call stack with Ajax disabled :

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RadGrid.LoadClientState(Dictionary`2 clientState) +7509
   Telerik.Web.UI.RadCompositeDataBoundControl.LoadPostData(String postDataKey, NameValueCollection postCollection) +193
   Telerik.Web.UI.RadCompositeDataBoundControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +42
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743


Here the aspx definition.

<telerik:RadGrid ID="RadGridCommunication" runat="server"    
    EnableViewState="False" 
    AutoGenerateColumns="False" 
    OnNeedDataSource="RadGridCommunication_NeedDataSource"   
    GridLines="None" 
    Skin="Office2007"                                              
    AllowPaging="True" 
    PageSize="3" 
    ShowStatusBar = "true"                                              
    > 
      
    <MasterTableView   
        CommandItemDisplay= "Top" 
        EditMode="InPlace" 
        > 
        <Columns> 
            <telerik:GridEditCommandColumn  UniqueName="EditCommandColumn" /> 
            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" DataFormatString="<nobr>{0}</nobr>" /> 
            <telerik:GridBoundColumn DataField="Age" HeaderText="Age" DataFormatString="<nobr>{0}</nobr>" /> 
            <telerik:GridBoundColumn DataField="Email" HeaderText="Email" DataFormatString="<nobr>{0}</nobr>"/>  
            <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone"  DataFormatString="<nobr>{0}</nobr>"/>  
        </Columns> 
          
        <CommandItemStyle  CssClass="gridCommandBar" />   
        <CommandItemTemplate> 
            <div style="float: left">    
                <asp:Label ID="Label1" CssClass="blockTitleForm" runat="server"  EnableViewState="False" >Communication Medium</asp:Label> 
            </div> 
            <div style="float: right">    
               <asp:LinkButton Style="vertical-align: bottom" ID="btnEditSelected" runat="server" EnableViewState="False"   
                CommandName="EditSelected" Visible='<%# RadGridCommunication.EditIndexes.Count == 0 %>' 
                > 
                <img style="border:0px" alt="" src="../im/btnGoToPage_01.png" / title="Edit selected item" EnableViewState="False"  >   
            </asp:LinkButton> 
            </div> 
              
          
        </CommandItemTemplate>                                                  
    </MasterTableView> 
    <ClientSettings AllowColumnsReorder="true" > 
        <ClientEvents OnCommand="RadGridCommunication_Command" /> 
        <Resizing   
        AllowColumnResize="True"   
        AllowRowResize="false"   
        ResizeGridOnColumnResize="false"                                                      
        ClipCellContentOnResize="true"   
        EnableRealTimeResize="false" /> 
    </ClientSettings> 
    <StatusBarSettings LoadingText="Loading ..." ReadyText ="Ready"/>                                              
</telerik:RadGrid> 

then the code behind taken from some Kevin Babcock samples :

[WebMethod]  
public static IEnumerable<NWA.POC.Models.Contact> GetData()  
{  
    var path = HttpContext.Current.Server.MapPath(@"Data\contacts.xml");  
    var xml = System.Xml.Linq.XDocument.Load(path)  
                       .Descendants("Contact");  
 
    var contacts = from contact in xml  
                   select new NWA.POC.Models.Contact  
                   {  
                       ID = Convert.ToInt32(contact.Element("ID").Value),  
                       Name = contact.Element("Name").Value,  
                       Age = Convert.ToInt32(contact.Element("Age").Value),  
                       Sex = contact.Element("Sex").Value,  
                       Email = contact.Element("Email").Value,  
                       Phone = contact.Element("Phone").Value  
                   };  
 
    return contacts;  
} 

Thanks in advance for your answer.
Nikolay Rusev
Telerik team
 answered on 17 Sep 2008
2 answers
90 views
Hello,

I'm using the radgrid control, and I'm wondering where I have to set the image that shows on the left side that the user clicks on to expand to the next level.  I set enableembeddedskins to false so I could use a custom skin, but now all that shows for that expand/collapse button is a button with nothing on it, it looks dumb.  I'd like to set it back to the chevron type thing that was there before, or maybe even a +/- sign.

Thanks,
Aaron
Aaron
Top achievements
Rank 1
 answered on 17 Sep 2008
1 answer
165 views
Greetings all

I'm trying to create a image gallery. The RadRotator doesn't work for me for a couple reasons, mainly the difficulty pulling images directly from a database versus a file share and the very large number of images I'm dealing with.  The grid offers more functionality like paging and grouping as well.  I can use cardview to display a thumbnail for each record, but I end up with only a single column of thumbnails.  Is there a way to make the rows wrap so that I see several columns of thumbnails on the screen?

For instance, 200 thumbnails returned per page, but after 40 thumbnails, wrap to the top of the screen, and so on for 5 columns of thumbnails.  Then after clicking the pager, show the next 200 records in the same way.

Any ideas appreciated.
Mark
Dimo
Telerik team
 answered on 17 Sep 2008
2 answers
300 views

I am tring to get the value of the DataValueID that I used to build the tree when nodeselcted is fired.  I get the text back but cant seem to get the orignal ID back.  Any Ideas?

Code Snippet.

       protected override void OnInit(EventArgs e)
        {
            RadTreeView1.Nodes.Clear();
            DataAccess.DA dt = new DA("Connection string");
            DB.m_da = dt;

            try
            {
                DataSet dsp = new DataSet();
                DB.m_da.SetRead("SELECT 'All Providers' AS [Name], '0' AS [ID], null as tree union SELECT [FName] + ' ' + [LName] AS [Name], [ID],0 as [Tree] FROM Provider WHERE [Inactive] = 0 ORDER BY 1", 1);
                DB.m_da.Run(ref dsp);

                RadTreeView1.DataSource = dsp;

                RadTreeView1.DataFieldID = "ID";
                RadTreeView1.DataTextField = "Name";
                RadTreeView1.DataFieldParentID = "Tree";

                RadTreeView1.DataBind();

                RadTreeView1.ExpandAllNodes();
                RadTreeView1.MultipleSelect = true;
                RadTreeView1.CheckBoxes = true;

            }
            catch (Exception ex)
            {
                string s = ex.Message;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "Providers Saved";
            System.Collections.Generic.IList<RadTreeNode> providercheck = RadTreeView1.CheckedNodes;
        }

        protected void RadTreeView1_NodeCheck(object sender, RadTreeNodeEventArgs e)
        {

            string check = e.Node.CheckState.ToString();
            //string provider = e.Node
            System.Collections.Generic.IList<RadTreeNode> providercheck = RadTreeView1.CheckedNodes;

 

 

            // DataSet dsp = new DataSet();
            // DB.m_da.SetRead("", 1);
            // DB.m_da.Run(ref dsp);
        }
}

Bruce St.Clair
Top achievements
Rank 2
 answered on 17 Sep 2008
3 answers
388 views

Hi,

I did the below code to get the return value "true" then submit the page again.
what happens is that before getting the value page submit.
first I want to know how to get the return true or false from radconfirm and then how to do submit then sequentially.

function

confirms(arg)

{

var bSave=radconfirm(arg,confirmCallBackFn,300,200,null,'Want to Save');

if (bSave)

{

alert(

'hello');

document.getElementById(

"hidServer").value=1;

document.getElementById(

"form1").submit();

}

else

{

document.getElementById(

"hidServer").value=0;

}

}



function

confirmCallBackFn(arg)

{

alert(arg);

if

(arg == true)

{

document.getElementById(

"form1").submit();

var

oManager = GetRadWindowManager();

oManager.Close();

}

else

{

alert(

'not Closed');

}

}

thanks,
Puru

Svetlina Anati
Telerik team
 answered on 17 Sep 2008
4 answers
856 views
Hi,

I am newbie for Telerik and I need help with Numeric Text Box.

Is it possible to increment/decrement values by .01 when button clicked. I have max value of 2.99 and min value of 0.9.

It should go like this: 0.9, 0.91, 0.92 and so on. Same with decrement.

I would appreciate any help, preferably with sample code.

thanks
Madhu
Madhu
Top achievements
Rank 1
 answered on 17 Sep 2008
5 answers
97 views
Hi

Is there any way to limit the number of visible appointments in the Weekly View of the Rad Scheduler..

There is way to do it in Monthly View...like  

MonthView-VisibleAppointmentsPerDay

="3"

Is there any way way to do something like this in Week View also.

Thanks in Advance..

Thanks and Regards
Archan

Peter
Telerik team
 answered on 17 Sep 2008
6 answers
525 views
Hi,

Could somebody give me an example of code using a radwindow in a masterpage?

Or somebody who could give me a clear sample program of dialog box (radwindow) returning a value?

I'm quite confused in the sample given at the documentation and also it is incomplete when it comes to explaining.

I'm just quite new to the technology and I wanted to use it in our project.

Thanks,
Jhun
Georgi Tunev
Telerik team
 answered on 17 Sep 2008
4 answers
149 views
does the c# example here http://demos.telerik.com/aspnet/prometheus/TreeView/Examples/Functionality/MultipleSelect/DefaultCS.aspx look correct?

I am trying to write the multiply selected tree nodes to a label - It seemed the node_click event would be what i need - however I've seen others have had some issues with it and apparently i am not going down the right path.

I don't see how to set the radtreeview control to autopostback = true

here is what i attempted

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

using

System.Data.SqlClient;

using

Telerik.Web.UI;

public

partial class radman : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

RadTreeView1.DataSource = createOrgTreeTable();

RadTreeView1.DataFieldID =

"OrgId";

RadTreeView1.DataFieldParentID =

"OrgParent";

RadTreeView1.DataTextField =

"Name";

RadTreeView1.DataValueField =

"Name";

RadTreeView1.MultipleSelect =

true;

RadTreeView1.DataBind();

}

private DataTable createOrgTreeTable()

{

SqlConnection sqlConn = new SqlConnection(TPWConfiguration.DbConnectionString);

sqlConn.Open();

SqlCommand CmdRoot = new SqlCommand("tpw_direct_reports_listing_all", sqlConn);

CmdRoot.CommandType =

CommandType.StoredProcedure;

CmdRoot.Parameters.Add(

new SqlParameter("@UserId", SqlDbType.VarChar));

CmdRoot.Parameters[

"@UserID"].Value = "jjb000;

DataTable dtOrgTree = new DataTable();

dtOrgTree.Columns.Add(

"OrgId");

dtOrgTree.Columns.Add(

"OrgParent");

dtOrgTree.Columns.Add(

"login");

dtOrgTree.Columns.Add(

"name");

SqlDataAdapter daRoot = new SqlDataAdapter(CmdRoot);

daRoot.Fill(dtOrgTree);

return dtOrgTree;

}

protected void ShowSelected()

{

lblSelectedNodes.Text =

"";

foreach (RadTreeNode node in RadTreeView1.SelectedNodes)

{

lblSelectedNodes.Text +=

"<br/>" + node.FullPath;

}

}

protected void Button1_Click(object sender, EventArgs e)

{

ShowSelected();

}

}

Yana
Telerik team
 answered on 17 Sep 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?