This is a migrated thread and some comments may be shown as answers.

Client side databinding, predefined columns

3 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dheeraj
Top achievements
Rank 1
Dheeraj asked on 21 Jun 2009, 07:22 AM
Hi,

Am facing a very strange issue, where i am using client side data binding and using a page method to return a business object.

When i use Autogenerate columns, the data is displayed fine. Where in, if i define the columns before hand and set AutoGenerateColumns to false, the data is not displayed.

Please find a screenshot here which I have taken when the autogeneratecolumn was set to true with three predefined columns.

Here is the aspx code:
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Untitled Page</title> 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">     
    <script type="text/javascript" language="javascript"
        function pageLoad() { 
            PageMethods.GetList(0, 5, updateGrid); 
        } 
 
        function updateGrid(result) { 
            var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); 
            tableView.set_dataSource(result); 
            tableView.dataBind(); 
        } 
    </script> 
    </telerik:RadCodeBlock> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="true"
        </telerik:RadScriptManager>    
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="True"  
            GridLines="None"
            <MasterTableView PageSize="5"
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="ProjectName" HeaderText="Project Name" UniqueName="column"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="ProjectID" HeaderText="Project ID" UniqueName="column1"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="ClientID" HeaderText="Client" UniqueName="column2"
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 

Please let me know how to fix this, I am new to using client side databinding ...

Edited: I was using telerik v:527 trial and then tried with 2009.1.617.35, but same issue.

Regards,
Dheeraj Juneja

3 Answers, 1 is accepted

Sort by
0
Dheeraj
Top achievements
Rank 1
answered on 22 Jun 2009, 06:52 AM
Pls, anyone can look and let us know what is that can be wrong here ?
0
Dheeraj
Top achievements
Rank 1
answered on 22 Jun 2009, 02:26 PM
Its a show stopper for us ... anyone to bail us out of this issue ??
0
Dheeraj
Top achievements
Rank 1
answered on 23 Jun 2009, 01:51 PM
Thanks for your help guys, the trick lied in using "UniqueName" instead of "DataField" when using client side data binding. Hoping that the documentation will be updated to reflect this.

Regards,
Dheeraj Juneja
Tags
Grid
Asked by
Dheeraj
Top achievements
Rank 1
Answers by
Dheeraj
Top achievements
Rank 1
Share this question
or