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

Is this forum Used? Last post 2013?? Help, Please with only want one column to be editable

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Derenthal
Top achievements
Rank 1
Thomas Derenthal asked on 24 Oct 2014, 01:08 AM
I have a grid and I only want the ApprovedAmt and isChecked to be editable when the form is loaded. How can I do this?
 <telerik:RadGrid ID="gridFundingBills" runat="server" Width="1100px" AllowMultiRowSelection="True"
                        CssClass=" MyGridClass"
                        AutoGenerateColumns="False"
                        OnNeedDataSource="gridFundingBills_NeedDataSource"
                        OnItemDataBound="gridFundingBills_ItemDataBound"
                        OnSelectedIndexChanged="gridFundingBills_SelectedIndexChanged"
                        OnPreRender="gridFundingBills_PreRender"
                        AllowMultiRowEdit="True">
                        <MasterTableView DataKeyNames="FundingDtlID" EditMode="InPlace">
                            <Columns>
                                <telerik:GridBoundColumn DataField="CustomerNm" FilterControlAltText="Filter CustomerNm column" HeaderText="Property" SortExpression="CustomerNm" UniqueName="CustomerNm">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="VendorNm" FilterControlAltText="Filter VendorNm column" HeaderText="Vendor" SortExpression="VendorNm" UniqueName="VendorNm">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="BankAcct" FilterControlAltText="Filter BankAcct column" HeaderText="Bank" ReadOnly="True" SortExpression="BankAcct" UniqueName="BankAcct">
                                </telerik:GridBoundColumn>
                                <telerik:GridHyperLinkColumn UniqueName="BillNo" HeaderText="Bill Reference Number" DataTextField="BillNo" DataNavigateUrlFields="BillUrl" DataNavigateUrlFormatString="http://{0}" Target="_blank">
                                </telerik:GridHyperLinkColumn>
                                <telerik:GridBoundColumn DataField="BillURL" FilterControlAltText="Filter BillURL column" ReadOnly="True" SortExpression="BillURL" UniqueName="BillURL" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="BillPeriod" FilterControlAltText="Filter BillPeriod column" HeaderText="Bill Period" ReadOnly="True" SortExpression="BillPeriod" UniqueName="BillPeriod" ItemStyle-Width="150px" HeaderStyle-Width="150px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="DueDt" DataType="System.DateTime" FilterControlAltText="Filter DueDt column" HeaderText="Due Date" SortExpression="DueDt" UniqueName="DueDt" DataFormatString="{0:d}" ItemStyle-Width="75px" HeaderStyle-Width="75px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="TotalAmt" DataType="System.Decimal" FilterControlAltText="Filter TotalAmt column" HeaderText="TotalAmt" SortExpression="Total Due" UniqueName="TotalAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="RemainingAmt" DataType="System.Decimal" FilterControlAltText="Filter RemainingAmt column" HeaderText="Remaining Balance" ReadOnly="True" SortExpression="RemainingAmt" UniqueName="RemainingAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="FundingDtlID" DataType="System.Guid" FilterControlAltText="Filter FundingDtlID column" HeaderText="FundingDtlID" ReadOnly="True" SortExpression="FundingDtlID" UniqueName="FundingDtlID" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="BankAcctID" DataType="System.Guid" FilterControlAltText="Filter BankAcctID column" HeaderText="BankAcctID" ReadOnly="True" SortExpression="BankAcctID" UniqueName="BankAcctID" Visible="false">
                                </telerik:GridBoundColumn>

                                <telerik:GridBoundColumn DataField="ApprovedAmt" DataType="System.Decimal" FilterControlAltText="Filter ApprovedAmt column" HeaderText="Amount Approved" ReadOnly="False" SortExpression="ApprovedAmt" UniqueName="ApprovedAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
                                </telerik:GridBoundColumn>
                                <telerik:GridCheckBoxColumn DataField="isChecked" DataType="System.Boolean" FilterControlAltText="Filter isChecked column" HeaderText="Pay in<br />Full" ReadOnly="False" SortExpression="isChecked" UniqueName="isChecked" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px">
                                </telerik:GridCheckBoxColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
                            <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true"></Selecting>
                            <%-- <Scrolling AllowScroll="true" ScrollHeight="500px" UseStaticHeaders="true" />--%>
                            <%-- <ClientEvents OnGridCreated="GridCreated" />--%>
                        </ClientSettings>
                    </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 28 Oct 2014, 01:30 PM
Hi Thomas,

If you would like to make a column in RadGrid not editable you need to set the ReadOnly property to true. After examining the provided code I noticed that only some columns were defined as ReadOnly. Try changing the markup like shown below and see how it works for you.

<telerik:RadGrid ID="gridFundingBills" runat="server" Width="1100px" AllowMultiRowSelection="True"
    CssClass=" MyGridClass"
    AutoGenerateColumns="False"
    OnNeedDataSource="gridFundingBills_NeedDataSource"
    OnItemDataBound="gridFundingBills_ItemDataBound"
    OnSelectedIndexChanged="gridFundingBills_SelectedIndexChanged"
    OnPreRender="gridFundingBills_PreRender"
    AllowMultiRowEdit="True">
    <MasterTableView DataKeyNames="FundingDtlID" EditMode="InPlace">
        <Columns>
            <telerik:GridBoundColumn DataField="CustomerNm" FilterControlAltText="Filter CustomerNm column" HeaderText="Property" SortExpression="CustomerNm" UniqueName="CustomerNm" ReadOnly="True">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="VendorNm" FilterControlAltText="Filter VendorNm column" HeaderText="Vendor" SortExpression="VendorNm" UniqueName="VendorNm" ReadOnly="True">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="BankAcct" FilterControlAltText="Filter BankAcct column" HeaderText="Bank" ReadOnly="True" SortExpression="BankAcct" UniqueName="BankAcct">
            </telerik:GridBoundColumn>
 
            <telerik:GridHyperLinkColumn UniqueName="BillNo" HeaderText="Bill Reference Number" DataTextField="BillNo" DataNavigateUrlFields="BillUrl" DataNavigateUrlFormatString="http://{0}" Target="_blank">
            </telerik:GridHyperLinkColumn>
 
            <telerik:GridBoundColumn DataField="BillURL" FilterControlAltText="Filter BillURL column" ReadOnly="True" SortExpression="BillURL" UniqueName="BillURL" Visible="false">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="BillPeriod" FilterControlAltText="Filter BillPeriod column" HeaderText="Bill Period" ReadOnly="True" SortExpression="BillPeriod" UniqueName="BillPeriod" ItemStyle-Width="150px" HeaderStyle-Width="150px">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="DueDt" DataType="System.DateTime" FilterControlAltText="Filter DueDt column" HeaderText="Due Date" SortExpression="DueDt" UniqueName="DueDt" ReadOnly="True" DataFormatString="{0:d}" ItemStyle-Width="75px" HeaderStyle-Width="75px">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="TotalAmt" DataType="System.Decimal" FilterControlAltText="Filter TotalAmt column" HeaderText="TotalAmt" SortExpression="Total Due" ReadOnly="True" UniqueName="TotalAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="RemainingAmt" DataType="System.Decimal" FilterControlAltText="Filter RemainingAmt column" HeaderText="Remaining Balance" ReadOnly="True" SortExpression="RemainingAmt" UniqueName="RemainingAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="FundingDtlID" DataType="System.Guid" FilterControlAltText="Filter FundingDtlID column" HeaderText="FundingDtlID" ReadOnly="True" SortExpression="FundingDtlID" UniqueName="FundingDtlID" Visible="false">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="BankAcctID" DataType="System.Guid" FilterControlAltText="Filter BankAcctID column" HeaderText="BankAcctID" ReadOnly="True" SortExpression="BankAcctID" UniqueName="BankAcctID" Visible="false">
            </telerik:GridBoundColumn>
 
            <telerik:GridBoundColumn DataField="ApprovedAmt" DataType="System.Decimal" FilterControlAltText="Filter ApprovedAmt column" HeaderText="Amount Approved" SortExpression="ApprovedAmt" UniqueName="ApprovedAmt" DataFormatString="{0:F}" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="75px" HeaderStyle-Width="75px">
            </telerik:GridBoundColumn>
 
            <telerik:GridCheckBoxColumn DataField="isChecked" DataType="System.Boolean" FilterControlAltText="Filter isChecked column" HeaderText="Pay in<br />Full" SortExpression="isChecked" UniqueName="isChecked" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="75px">
            </telerik:GridCheckBoxColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="true" EnablePostBackOnRowClick="true">
        <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true"></Selecting>
        <%-- <Scrolling AllowScroll="true" ScrollHeight="500px" UseStaticHeaders="true" />--%>
        <%-- <ClientEvents OnGridCreated="GridCreated" />--%>
    </ClientSettings>
</telerik:RadGrid>

In case the issue persists would you elaborate more on the scenario that you would like to implement? What are your requirements and what should be the expected behavior?


Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Thomas Derenthal
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or