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
10
How to update modified values when using template columns and ObjectDataSource
posted

Hi,

I have a templated column in my webdatagrid which contains a dropdownlist.
I am using the InitializeRow event to bind data to this dropdownlist.
Also I am using ObjectDataSource as the datasource for this webdatagrid.

My problem is that when the selected value in the dropdownlist is updated and postback occurs,the update method of the ObjectDataSource is not called.

How can the update method be invoked and the new value passed to the Update function?

The following is the markup and code that I am using:-

 <ig:TemplateDataField CssClass="rowHeight" Key="UE_SERVER_ID" Width="9%">
   <ItemTemplate>
     <asp:DropDownList ID="ddlUEServer" runat="server"></asp:DropDownList>
   </ItemTemplate>
   <Header Text="UE Server" />
</ig:TemplateDataField>

<asp:ObjectDataSource ID="dsRunBooks" runat="server" TypeName="IMS.Admin.BLRunBook"
        SelectMethod="BLGetRunBooks" UpdateMethod="BLUpdateRunBook" DeleteMethod="BLDeleteRunBook"
        InsertMethod="BLInsertRunBook" EnablePaging="true" EnableCaching="false">
        <InsertParameters>
            <asp:Parameter Name="server_id" Type="Int32" />
            <asp:Parameter Name="patch_week_id" Type="Int32" />
            <asp:Parameter Name="patch_method_id" Type="Int32" />
            <asp:Parameter Name="time_to_patch" Type="String" />
            <asp:Parameter Name="comments" Type="String" />
            <asp:Parameter Name="vendor_name" Type="String" />
            <asp:Parameter Name="patch_group" Type="String" />
            <asp:Parameter Name="ue_server_id" Type="Int32" />
            <asp:Parameter Name="env" Type="String" />
            <asp:Parameter Name="location" Type="String" />
            <asp:Parameter Name="deleteRowTemplate" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="server_id" Type="Int32" />
            <asp:Parameter Name="patch_week_id" Type="Int32" />
            <asp:Parameter Name="patch_method_id" Type="Int32" />
            <asp:Parameter Name="time_to_patch" Type="String" />
            <asp:Parameter Name="comments" Type="String" />
            <asp:Parameter Name="vendor_name" Type="String" />
            <asp:Parameter Name="patch_group" Type="String" />
            <asp:Parameter Name="ue_server_id" Type="Int32" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="server_id" Type="Int32" />
        </DeleteParameters>
</asp:ObjectDataSource>

 


protected void ugRunBooks_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
        {
            DropDownList ddlUEServers = (DropDownList)e.Row.Items[UE_SERVER].FindControl("ddlUEServer");
            DataRowView dr = e.Row.DataItem as DataRowView;
            if (ddlUEServers == null) return;
            ddlUEServers.DataSource = ueServerTable;
            ddlUEServers.DataTextField = "SERVER_NAME";
            ddlUEServers.DataValueField = "UE_SERVER_ID";
            ddlUEServers.DataBind();
            ddlUEServers.SelectedValue = dr.Row.ItemArray[14].ToString();
        }

Any help is greately appreciated!!

Thanks.