[CLOSED] Setting Store Datasource - MVC

  1. #1

    [CLOSED] Setting Store Datasource - MVC

    I have a controller which is using the controller extensions and as such, I am using the GetCmp method for a store. After that I am trying to set the store's datasource from a list of a model:



               Dim emailData As New List(Of Email)
               emailData.Add(New Email() With {.Subject = "Test Email", _
                                                .Sender = sample.CorrespondentInfo.EmailAddress, _
                                                .CarbonCopy = Me.MakeRecipient(sample.BrokerInfo), _
                                                .Body = Me.MakeBody(sample), _
                                                .Recipient = Me.MakeRecipient(sample.Documents(0).Cedent) _
                                                            + Me.MakeRecipient(sample.Documents(0).Reinsurers)})
    
                Me.GetCmp(Of Store)("storeEmail").DataSource = emailData
                Me.GetCmp(Of Store)("storeEmail").DataBind()

    The controller goes through a lot of rules to get the correct information, but in the end, it just provides string values to the email object. I have inspected the email object, and it is functioning as expected. I have inspected the Me.GetCmp(Of Store)("storeEmail") code and it is getting the correct component. However, after I set the DataSource property and inspect it, the value is "null" -even though I have one item in my list. The result is that nothing is being bound to my store. Is there anything obvious here I am missing on setting the datasource of a store?

    Thanks in advance.
    Last edited by Daniil; Oct 26, 2012 at 5:55 PM. Reason: [CLOSED]
  2. #2
    Hi @adelaney,

    Is it all during a DirectEvent?
  3. #3
    It is currently within a Ajax.BeginForm block.
  4. #4
    Just an extra bit of info - I don't think I actually have the store. If I inspect this: Me.GetCmp(Of Store)("storeEmail"), I do see an object, but even if I put in a fake ID (e.g. "store123") that I know doesn't exist, I still get an object to inspect in the immediate window. So, how do I know whether the controller really has the "real" component or not? (I would have expected a "nothing" for an invalid ID).
  5. #5
    Quote Originally Posted by adelaney View Post
    It is currently within a Ajax.BeginForm block.
    Well, you could just use the Store's DataSource property.
    .DataSource(emailData)
    Quote Originally Posted by adelaney View Post
    Just an extra bit of info - I don't think I actually have the store. If I inspect this: Me.GetCmp(Of Store)("storeEmail"), I do see an object, but even if I put in a fake ID (e.g. "store123") that I know doesn't exist, I still get an object to inspect in the immediate window. So, how do I know whether the controller really has the "real" component or not? (I would have expected a "nothing" for an invalid ID).
    Well, X.GetCmp<>() does know nothing about real controls. Generally, Razor engine doesn't operate at all with the "control" term.

    This method just creates a proxy class which can be used to generate JavaScript during DirectEvents or DirectMethods which calls controller actions.

Similar Threads

  1. Replies: 5
    Last Post: Feb 01, 2012, 11:54 AM
  2. [CLOSED] ComboBox / Store / DataSource : Store.DataSource is NULL
    By wagger in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Apr 24, 2011, 10:09 AM
  3. Store and clear datasource
    By glenh in forum 1.x Help
    Replies: 0
    Last Post: Oct 20, 2010, 5:18 AM
  4. Replies: 1
    Last Post: Oct 12, 2010, 8:39 PM
  5. why the DataSource of the store is null
    By animalisme in forum 1.x Help
    Replies: 2
    Last Post: Jun 22, 2009, 3:04 AM

Tags for this Thread

Posting Permissions