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
275
WebDropDown setting SqlDataSource parameter from grid
posted

I have a WebHierarchicalDataGrid with a TemplateDataField and a WebDropDown control for one of the columns.  I have a SqlDataSource control configured to populate the WebDropDown control in the grid.  One of the parameters I want to use for SqlDataSource is a value in the grid.  

When the WebDropDown control is being populated for that row in the grid, how can I reference a field in the grid for that row to pass to the SqlDataSource control as a parameter?

Parents
No Data
Reply
  • 16310
    Offline posted

    HI Chris,

    You can benefit from the DataBinder.Eval method to evaluate expressions at runtime.

    There are many threads showing how to do this in the WebDataGrid in different scenarios. I am giving you an example of how to use it below:

    <ig:TemplateDataField Key="Name" width="40%">
        <Header Text="Name" />

        <ItemTemplate>
            <asp:HyperLink runat="server"
                  Text='<% #DataBinder.Eval(Container,"DataItem.Name") %>'></asp:HyperLink>
         </ItemTemplate>
    </ig:TemplateDataField>

    Where Name is the grid field that you want to reference. The whole expression will evaluate to the value of the corresponding row and column. Please let me know if you have further questions, I will be glad to help.

    Hristo

Children
No Data