Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 3 of 3

Thread: Integrating a GridView component

  1. #1
    jwallwork is offline Member
    Join Date
    Sep 2008
    Posts
    38

    Default Integrating a GridView component

    Has anyone successfully used a gridview component with the ASPDotNetStorefront DB class.

    I'm creating a custom page that will be using a GridView component to capture data to a new table I added. However if I use the DB.FillDataSet function to create the data source for the control, I get an error message when a postback event executes on the page. The following message occurs:

    Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.


    The problem does not occur if I make the connection using a SQLDataSource component. I would prefer to use the DB class so that I do not have to maintain two separate connection strings.

    Thanks,

    John

  2. #2
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    Sounds like databinding issue not inherent on the DB class.
    Take a look at this blog:

    http://weblogs.asp.net/davidfowler/a...acontrols.aspx

  3. #3
    DanV's Avatar
    DanV is offline Ursus arctos horribilis
    Join Date
    Apr 2006
    Posts
    1,568

    Default

    In the PageLoad event, just set the SqlDataSource.ConnectionString property to DB.GetDBConn() That will override whatever is coded into the SqlDataSource control with the value from your web.config. That may however prevent you from working with the gridview in design mode. We've run into the same here on some of our custom licensing mods using the RADGrid, so generally what we do is hard-code our dev environment connection string in the control declaration on the ASPX page, but use the trick mentioned previously to override that on page load with the DBConn string from the web.config. Then the control works in both design time and production runtime.