I have a radgrid with a column for comments. Its purpose is for the user to explain why they made a change to that particular item. To enable that I have made it a template column and in the EditItemTemplate, I've added a required field validator. So far so good. However, the requirement means that EVERY time a change is made, a new comment is required. As it is, when the user clicks the edit button, the text from the previous comment is shown in the textbox. If the user clicks update, the required field validator sees that text and validates the field.
That code looks like this
I tried replacing the Text='<%# Bind("Comments")%>' with Text='' but then the new text was not returned. ( A trace showed that parameter value to be null). I have tried to keep the application simple and so am not currently using any code-behind. If possible, I'd like to avoid that.
So, I'm looking for some help in how to clear the textbox when the edit button is pushed so the required field validator will do its work, while still having the new comment included when the page is posted back.
I appreciate any help you can give.
Thanks
Rick
That code looks like this
<telerik:GridTemplateColumn DataField="Comments" AllowFiltering="false" FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments" UniqueName="Comments">
<EditItemTemplate>
<asp:TextBox ID="txtComments" runat="server" Text='<%# Bind("Comments")%>' TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvComments" ControlToValidate="txtComments" Display="Dynamic" runat="server" ErrorMessage="Please enter a reason for changing this budget item."></asp:RequiredFieldValidator>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
I tried replacing the Text='<%# Bind("Comments")%>' with Text='' but then the new text was not returned. ( A trace showed that parameter value to be null). I have tried to keep the application simple and so am not currently using any code-behind. If possible, I'd like to avoid that.
So, I'm looking for some help in how to clear the textbox when the edit button is pushed so the required field validator will do its work, while still having the new comment included when the page is posted back.
I appreciate any help you can give.
Thanks
Rick