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

[Solved] Set propery code behind VB.net

1 Answer 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rahul
Top achievements
Rank 1
Rahul asked on 28 Aug 2009, 11:05 AM
 <telerik:RadGrid ID="dgAddCart" runat="server" AllowPaging="True" PageSize ="15" DataSourceID="SqlDataSource1"
                   GridLines="None" Skin="Black" HeaderStyle-Font-Bold ="true"  >
                    <ClientSettings>
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="335px" />
                        <Resizing AllowColumnResize="true" AllowRowResize="false" ResizeGridOnColumnResize="false"
                            ClipCellContentOnResize="true" />
                    </ClientSettings>

<telerik:GridBoundColumn DataField="Proposal_ID" HeaderText="Proposals"
                                SortExpression="Proposal_ID" UniqueName="Proposal_ID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EstTrials" DataType="System.Int32" FooterText="Total : "  Aggregate = "Sum"
                                HeaderText="Trials" SortExpression="EstTrials" UniqueName="Trials :">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="EstCost" DataType="System.Decimal" Aggregate="Sum"
                               DataFormatString ="{0:c}"  HeaderText="Cost" SortExpression="EstCost" UniqueName="Cost :">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CropName" HeaderText="CropName" Display = "false"
                                SortExpression="CropName" UniqueName="CropName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ProdName" HeaderText="ProdName" Display = "false"  
                                SortExpression="ProdName" UniqueName="ProdName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TerritoryName" HeaderText="TerritoryName" Display = "false"
                                ReadOnly="True" SortExpression="TerritoryName" UniqueName="TerritoryName">
                            </telerik:GridBoundColumn>
                            <telerik:GridButtonColumn ButtonType ="ImageButton" ImageUrl ="images/Delete.gif" HeaderText ="Remove">
                                          
                            </telerik:GridButtonColumn>

 <GroupByExpressions >                       
                        <telerik:GridGroupByExpression>                       
                        <SelectFields>
                        <telerik:GridGroupByField FieldName ="ProdName"
                                                  HeaderText ="Product"
                                                 
                                                  HeaderValueSeparator = " : " />
                        </SelectFields>         
 <GroupByFields >
                       <telerik:GridGroupByField FieldName ="ProdName"  />
                        <telerik:GridGroupByField FieldName ="TerritoryName" />
                        <telerik:GridGroupByField FieldName ="CropName" />
                        </GroupByFields>
                        </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                    </mastertableview>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
                    ConnectionString="<%$ ConnectionStrings:GowanKB2ConnectionString %>"
                   
                    SelectCommand="SELECT [Proposal_ID], [EstTrials], [EstCost], [CropName], [ProdName], [TerritoryName] FROM [QryProposalGrpWithPests]"
                    ProviderName="<%$ ConnectionStrings:DevProviderName %>">
                </asp:SqlDataSource>



How to set this propery throught code behind. Its very urgent help me ?


I am most thankfull Princey
Thanks
Regards
Rahul Mahajan


1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 28 Aug 2009, 12:18 PM
Hello Rahul,

There are two options for creating a RadGrid instance dynamically:

  • You can declare the RadGrid control in the ASPX file and define its structure in the code-behind.
  • You can create the RadGrid entirely in the code-behind.

Checkout the documenatation which describes these approaches:
Programmatic creation

Thanks,
Princy.

Tags
Grid
Asked by
Rahul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or