ListView binding issue

9 posts, 1 answers
  1. Andy
    Andy avatar
    54 posts
    Member since:
    Jun 2009

    Posted 10 Jul 2010 Link to this post

    Hi guys!
    We've been using Telerik.Web.UI v.2010.1.309.35 in our project, and recently have switched to v.2010.1.519.35 . Since that I've discovered that ListView doesn't seem to process <%%> tags correctly during binding. For instance, here's the EditItemTemplate that I have:
    <EditItemTemplate>
     <tr>
      <td style="vertical-align:top">
       <rlt:TextBox ID="txtDurationMonth" runat="server" 
                    ValueType="Integer"
                    Width="50px" 
                    Text='<%#Eval("DurationMonth") %>'
       ></rlt:TextBox>
       <asp:RangeValidator runat="server" 
                    ControlToValidate="txtDurationMonth" 
                    ErrorMessage="Integer value required" 
                    MinimumValue="0" 
                    MaximumValue="<%#int.MaxValue %>" 
                    Type="Integer" 
                    SetFocusOnError="true">
       </asp:RangeValidator>
      </td>
      <td style="vertical-align:top">
       <rlt:LinkButton ID="lbSave" runat="server" 
              CommandName="<%#RadListView.UpdateCommandName%>" CommandArgument='<%#Eval("Id") %>'>Save</rlt:LinkButton>
      </td>
     </tr>
    </EditItemTemplate>
    When I switch into Edit mode, I started getting an exception that it cannot parse '' (empty string) for MaximumValue of rangevalidator. I removed that validator at all and it switched fine, but CommandName of lbSave was always empty. Also, ListView has DataKeyNames="Id" However, if I try to get an ID in ListView ItemCommand handler like this:

    ((

    RadListViewDataItem)e.ListViewItem).GetDataKeyValue("Id")

    I get "index was out of range" exception. So I had to switch back to v.2010.1.309.35.  And now it works as it should, but that version has an issue with RadEditor, which is being stretched in some occasions.
    So, is it some bug or do I miss something? Thanx in advance!

     

  2. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 12 Jul 2010 Link to this post

    Hello Andy,

    Unfortunately I'm unable to observe the described behavior locally. Therefore can you please provide more details about your scenario and implementation, such as how the control is populated etc.?

    Kind regards,
    Rosen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy
    Andy avatar
    54 posts
    Member since:
    Jun 2009

    Posted 12 Jul 2010 Link to this post

    Thanx for reply, Rosen!

    We bind datasource in ListView.NeedDataSource event handler, and bind to a generic list:

    void lvPriceList_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
    {
      CommonMethods.BindControlToEntity<Price>(lvPriceList, p => p.TypeId == SelectedPriceTypeId);
    }

    and here's the code for CommonMethods.BindControlToEntity<T> method:
    public static void BindControlToEntity<T>(DataBoundControl ctrl, Expression<Func<T, bool>> expression) where T : Entity<RealtorDataContext>, IName
    {
     ctrl.DataSource = Box.Box.GetSortedList<T>(expression);
     if (! (ctrl is ListView))
      ctrl.DataBind();
    }

    Box.Box.GetSortedList<T>(Expression<Func<T, bool>> expression) just returns a generic list of T
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 13 Jul 2010 Link to this post

    Hello Andy,

    Unfortunately I'm still unable to recreate the mentioned  behavior. However I have noticed that in BindControlToEntity method you have a check for ListView instead for RadListView, which should cause exception if this method is called from within NeedDataSource event handler, can you please check?
    And just to make sure, you are using the default RadListView implementation, without any modifications, right?

    Regards,
    Rosen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Andy
    Andy avatar
    54 posts
    Member since:
    Jun 2009

    Posted 13 Jul 2010 Link to this post

    Hi Rosen!

    ListView class is inherited from RadListView, but it has absolutely no code inside. Did that in case I would need some additional functionality in the future, but had nothing to add so far :) Well, the weird thing about it is that it works fine with an older version of Telerik.Web.UI.dll . I'll try to make a sample project and see if that issue still occures.

    Thanx for your attention!

     

     

  7. Andy
    Andy avatar
    54 posts
    Member since:
    Jun 2009

    Posted 14 Jul 2010 Link to this post

    Looks like we found the problem = it's with InsertItemTemplate actually, not EditItemTemplate.
    If we use <%#int.MaxValue%> for example, it renders into empty string. Maybe in the newer version InsertItem doesn't participate in databinding process, thus # doesn't work? Sorry for confusion. Please let me know if you are still unable to reproduce the issue. We have a sample project to illustrate it.
  8. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 14 Jul 2010 Link to this post

    Hello Andy,

    Can you please check the latest (Q2 2010) release? This behavior should be addressed with it.

    Kind regards,
    Rosen
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Andy
    Andy avatar
    54 posts
    Member since:
    Jun 2009

    Posted 22 Jul 2010 Link to this post

    Hi Rosen!
    We have finally re-newed our subscription and got the latest version. Yes, this issue seems to be fixed there.. however we started to get some javascript errors in other places, so had to roll-back again.
  10. Neha
    Neha avatar
    1 posts
    Member since:
    Aug 2010

    Posted 16 Aug 2010 Link to this post

    Hi,
    Try using  link ListView.

    Regards
    TotalDotnet
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017