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

Add New Record Creates Text Boxes For All Columns in my Grid, I just want one

1 Answer 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 05 Nov 2012, 03:43 PM
Add New Record Creates Text Boxes For All Columns in my Grid, I just want one.  It's a very simple page to populate a drop down list.
There are 2 columns, the table ID Attach_Type_ID (INT) and the DDL value Name.

 

 

 

<Columns>
  
<telerik:GridBoundColumn DataField="Attach_Type_ID" 
  
HeaderText="Attach_Type_ID" 
  
visible="False">
  
</telerik:GridBoundColumn>
  
<telerik:GridBoundColumn DataField="Name" MaxLength="50" 
  
FilterControlAltText="Filter Name column" HeaderText="Attachment Type" 
  
UniqueName="Name">
  
<HeaderStyle Width="72px"/> 
  
</telerik:GridBoundColumn>
  
<telerik:GridButtonColumn ConfirmText="Delete?" ConfirmDialogType="RadWindow" 
  
ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
  
</Columns>
For Add New Record, I just want to see Name.  I will do an insert and SQL will generate a new ID.
What I get is two textboxes, one for
"Attach_Type_ID" and one for "Name".
Hwo do I get rid tjhe one for "Attach_Type_ID" ?
Here's all the .ASPX:

 

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Login.Master" CodeBehind="AdminAttachmentType.aspx.vb" Inherits="ConEdison.PTAR.AdminAttachmentType" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <style type="text/css">
            .orderText
            {
                font: normal 12px Arial,Verdana;
                margin-top: 6px;
            }
        </style>
    </telerik:RadCodeBlock>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentHeader" runat="server">
<b>
Attachment Type Administration
</b>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script src="scripts/admin.js" type="text/javascript"></script>
        </telerik:RadCodeBlock>
          
    <telerik:RadAjaxManager ID="Attach_TypeAjaxManager" runat="server" OnAjaxRequest="Attach_TypeAjaxManager_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Attach_TypeAjaxManager">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Attach_TypeRadGrid" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="Attach_TypeRadGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Attach_TypeRadGrid" />
                         <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                        <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>             
          
<telerik:RadGrid OnItemCreated="Attach_TypeRadGrid_ItemCreated" ID="Attach_TypeRadGrid" runat="server"
        AllowPaging="False"  AllowAutomaticDeletes="True"
         CellSpacing="0"  ShowGroupPanel="False"  
        PageSize="50" Skin="Web20" >
          
        <FilterMenu EnableImageSprites="False"></FilterMenu>
  
        <ClientSettings AllowColumnsReorder="True" AllowDragToGroup="False"   
            ReorderColumnsOnClient="True">    
            <Selecting AllowRowSelect="True" />
            <Scrolling AllowScroll="False" UseStaticHeaders="True" />
        </ClientSettings>
  
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Name" ClientDataKeyNames="Name" Width="100%" CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"  ShowRefreshButton="True"></CommandItemSettings>
  
<RowIndicatorColumn Visible="True" SortedBackColor="lightblue" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
    <Columns>
          <telerik:GridBoundColumn DataField="Attach_Type_ID"   
            HeaderText="Attach_Type_ID"  
             visible="False">
           </telerik:GridBoundColumn>
          <telerik:GridBoundColumn DataField="Name" MaxLength="50" 
            FilterControlAltText="Filter Name column" HeaderText="Attachment Type" 
            UniqueName="Name">
            <HeaderStyle Width="72px"/>    
        </telerik:GridBoundColumn>
        <telerik:GridButtonColumn ConfirmText="Delete?" ConfirmDialogType="RadWindow"   
                     ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
    </Columns>
</MasterTableView>
</telerik:RadGrid>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
  
  <telerik:RadInputManager runat="server" ID="RadInputManager1" Enabled="true">
        <telerik:TextBoxSetting BehaviorID="TextBoxSetting1">       </telerik:TextBoxSetting>
 </telerik:RadInputManager>
</asp:Content>
    <asp:Content ID="Content5" ContentPlaceHolderID="ContentScriptHolder" runat="server">
</asp:Content>

 

 


 

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 05 Nov 2012, 08:27 PM
I solved it. 

 

<telerik:GridBoundColumn DataField="Attach_Type_ID"  needs ReadOnly="True"

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or