Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
 

Pages: 1
LLBLGen Pro Runtime Framework
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Page:1/1 

  Print all messages in this thread  
Poster Message
like2175
User



Location:
Camberley, United Kingdom
Joined on:
27-Mar-2006 16:16:06
Posted:
81 posts
# Posted on: 28-Aug-2007 15:24:05.  
I keep running into this problem. I wonder if there are any particular things that cause this when binding dropdown lists within gridviews to LLBLGenProDatasources (v2). I've read loads of posts on other forums, but still don't understand what the problem is.

Any comments welcomed.

Self-servicing
ora 9.2.0
asp.net (vb)
  Top
goose
User



Location:
Central America
Joined on:
06-Aug-2007 18:21:05
Posted:
385 posts
# Posted on: 28-Aug-2007 18:31:24.  
This most of the time is related on how we place the DataSources in the databinding scope and which fields are referenced.

Can you post some code to see how are you binding the DropDownLists?



gansodesoya  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14464 posts
# Posted on: 29-Aug-2007 10:39:45.  
Sometimes this occurs when you use one of the above functions like Bind() on a control where there is no dataSource available to bind to.
Like if you are having the dropdownList in the Grid's footer or in the EmptyTemplate of the Grid.
The dataSource bound to the grid is not exposed to the controls in the footer ot in the EmptyTemplate.
  Top
like2175
User



Location:
Camberley, United Kingdom
Joined on:
27-Mar-2006 16:16:06
Posted:
81 posts
# Posted on: 06-Aug-2008 12:10:40.  
As a follow up... The same error seems to occur on InsertItemTemplate on listview.

Here is what I attempted:
Code:
<InsertItemTemplate>
     <tr>
             <td>
                 Rag Status
                 <asp:DropDownList ID="ddlRagStatusIdInsert" runat="server" DataSourceID="dsRagStatus"
                 SelectedValue='<%# Bind("RagStatusId") %>'
                    DataTextField="DescrShort" DataValueField="RagStatusId" AppendDataBoundItems="true">
                    <asp:ListItem Text="-Select-" Value="" Enabled="True"></asp:ListItem>
                 </asp:DropDownList>
</td></tr> etc...


I have got around this with:
Code:
Private Sub lvIssue_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles lvIssue.ItemInserting

    e.Values("LastUpdate") = Now.ToString
    e.Values("LastUpdateBy") = HttpContext.Current.User.Identity.Name
    ' Grab selected value rather than binding with SelectedValue='<%# Bind("RagStatusId") %>'

    e.Values("RagStatusId") = CType(CType(sender, ListView).InsertItem.FindControl("ddlRagStatusIdInsert"), DropDownList).SelectedValue

End Sub


Hope this helps someone!


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.