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

Bound value not displaying

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JSON
Top achievements
Rank 1
JSON asked on 01 Jul 2010, 07:08 PM
Hello,

I have a simple RADGrid bound to a SQLDataSource with a RadTemplateColumn/EditItemTemplate RadTextBox control. I used the Telerik provided example to apply the bound value but it only is visible in EditMode. What am I missing?

Thank you,

SteveO

 

<telerik:RadGrid ID="RadGrid1"

 

 

    runat="server"

 

 

    AllowAutomaticDeletes="True"

 

 

    AllowAutomaticInserts="True"

 

 

    AllowAutomaticUpdates="True"

 

 

    GridLines="None"

 

 

    OnItemInserted="RadGrid1_ItemInserted"

 

 

    OnItemCreated="RadGrid2_ItemCreated"

 

 

    OnItemUpdated="RadGrid1_ItemUpdated"

 

 

    OnInsertCommand="RadGrid1_ItemInsert"

 

 

    OnUpdateCommand="RadGrid1_ItemUpdate"

 

 

    Skin="Simple"

 

 

    ShowStatusBar="True"

 

 

    DataSourceID="SqlDataSource2"

 

 

    AllowPaging="True" >

 

 


<
ValidationSettings EnableValidation="true" ValidationGroup="DropDownValidate" />

 

 


<
MasterTableView runat="server"

 

 

    EditMode="InPlace"

 

 

    CommandItemDisplay="Top"

 

 

    DataSourceID="SqlDataSource2"

 

 

    AutoGenerateColumns="false"

 

 

    ExpandCollapseColumn-ButtonType="ImageButton"

 

 

    ExpandCollapseColumn-CollapseImageUrl="~/Images/zoom-out-icon[1].png"

 

 

    ExpandCollapseColumn-ExpandImageUrl="~/Images/zoom-in-icon[1].png"

 

 

    DataKeyNames="ActivityID"

 

 

    InsertItemPageIndexAction="ShowItemOnCurrentPage" >

 

 

 


<
RowIndicatorColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 


<
EditFormSettings>

 

 

<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"

 

 

CancelImageUrl="~/Images/filterCancel.png"

 

 

UpdateImageUrl="~/Images/selecttag.png"

 

 

InsertImageUrl="~/Images/add-icon[2].png"

 

 

EditImageUrl="~/Images/edit-icon[1].png" >

 

 

</EditColumn>

 

 

</EditFormSettings>

 

 

 


<
Columns>

 

 

 

    <telerik:GridTemplateColumn DataField="ActDescription" HeaderText="Description" UniqueName="ActDescription" Display="true">

 

 

        <EditItemTemplate>

 

 

            <telerik:RadTextBox ID="Description" runat="server" Text='<%# Bind("ActDescription") 
                
TextMode="MultiLine"                     Width="300"></telerik:RadTextBox>

 

 

        </EditItemTemplate>

 

 

    </telerik:GridTemplateColumn>
</Columns>

 

 


</
MasterTableView>

 

 

 

 

 

</telerik:RadGrid>

 

 

<asp:SqlDataSource ID="SqlDataSource2" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:CIMT %>"

 

 

DeleteCommand="DELETE FROM [CIMT_T_Activities] WHERE [ActivityID] = @ActivityID"

 

 

InsertCommand="INSERT INTO [CIMT_T_Activities] ([ActDescription], [ActToDate], [ActFromDate], [UnitLogID], [InsertBy], [InsertDate], [UpdateBy], [UpdateDate]) VALUES (@ActDescription, @ActToDate, @ActFromDate, @UnitLogID, @InsertBy, @InsertDate, @UpdateBy, @UpdateDate)"

 

 

SelectCommand="SELECT [ActivityID], [ActDescription], [ActToDate], [ActFromDate], [UnitLogID], [InsertBy], [InsertDate], [UpdateBy], [UpdateDate] FROM [CIMT_T_Activities] WHERE [UnitLogID] = @UnitLogID"

 

 

UpdateCommand="UPDATE [CIMT_T_Activities] SET [ActDescription] = @ActDescription, [ActToDate] = @ActToDate, [ActFromDate] = @ActFromDate, [UnitLogID] = @UnitLogID, [UpdateBy] = @UpdateBy, [UpdateDate] = @UpdateDate WHERE [ActivityID] = @ActivityID">

 

 

 

 

 

<SelectParameters>

 

 

 

 

 

<asp:SessionParameter Name="UnitLogID" SessionField="UnitLogID" Type="Int32" />

 

 

 

 

 

</SelectParameters>

 

 

 

 

 

<DeleteParameters>

 

 

 

 

 

<asp:Parameter Name="ActivityID" Type="Int32" />

 

 

 

 

 

</DeleteParameters>

 

 

 

 

 

<InsertParameters>

 

 

 

 

 

<asp:SessionParameter Name="UnitLogID" SessionField="UnitLogID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="ActDescription" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="ActToDate" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="ActFromDate" />

 

 

 

 

 

<asp:Parameter Name="InsertBy" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="InsertDate" />

 

 

 

 

 

<asp:Parameter Name="UpdateBy" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="UpdateDate" />

 

 

 

 

 

</InsertParameters>

 

 

 

 

 

<UpdateParameters>

 

 

 

 

 

<asp:SessionParameter Name="UnitLogID" SessionField="UnitLogID" Type="Int32" />

 

 

 

 

 

<asp:Parameter Name="ActDescription" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="ActToDate" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="ActFromDate" />

 

 

 

 

 

<asp:Parameter Name="InsertBy" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="InsertDate" />

 

 

 

 

 

<asp:Parameter Name="UpdateBy" Type="String" />

 

 

 

 

 

<asp:Parameter DbType="DateTime" Name="UpdateDate" />

 

 

 

 

 

<asp:Parameter Name="ActivityID" Type="Int32" />

 

 

 

 

 

</UpdateParameters>

 

 

 

 

 

</asp:SqlDataSource>

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 02 Jul 2010, 06:23 AM
Hello Steve,

Since the the EditItemTemplate rendered the control in edit mode, you have to set the ItemTemplate which displays in normal (non-Edit) mode. 

ASPX:
 
 <telerik:GridTemplateColumn DataField="ActDescription" HeaderText="Description" UniqueName="ActDescription" 
                        Display="true"
      <ItemTemplate> 
           <%# Eval("ActDescription")%> 
      </ItemTemplate> 
      <EditItemTemplate> 
           <telerik:RadTextBox ID="Description" runat="server" Text='<%# Bind("ActDescription")%>' 
                                TextMode="MultiLine" Width="300"
           </telerik:RadTextBox> 
      </EditItemTemplate> 
 </telerik:GridTemplateColumn> 

Thanks,
Princy.
0
JSON
Top achievements
Rank 1
answered on 02 Jul 2010, 12:07 PM
Princy,

Yes and Thank you!

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