Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
350
Row Templates - User Control (columnKey Property)
posted

Hello,

 When I try to use the columnKey property to associate data on a standard <asp:label it does not work, it appears it only works for <asp:TextBox

How can I associate data for labels?

Thanks,

 

 

Parents
No Data
Reply
  • 45049
    posted

    The ColumnKey attribute only works for a control that has a particular attribute (Value, if I remember right) to store its value.  An ASP.NET label store's its value as its inner HTML, so ColumnKey won't work for this control.

    Instead, you'll need to write JavaScript to copy the appropriate value from your WebGrid column to the label in your row edit template, specifically in the BeforeRowTemplateOpen client-side event handler.  On the plus side, since a label is read-only, you won't need to copy the data back from the control to your grid column in the AfterRowTempalteClose event handler.

    For more information on how to do this, please refer to the following article from our online Knowledge Base:
    HOWTO: Placing complex controls into the RowEditTemplate

Children
No Data