Hi,
I have dropdownprovider for a column in webdatagrid. I have objectdatasource mapped to the grid. All the text fields works fine. But dropdownprovider doesnt return the correct value to the object data source update method. Can anyone provide with an example how to accomplish that?
<ig:WebDataGrid ID="wdgWorkbench" runat="server" Width="90%" Height="555" DataKeyFields="TrialId"
AutoGenerateColumns="false" DataSourceID="objDSTrial" CellSpacing="0" OnDataBinding="wdgWorkbench_OnDataBinding"
OnInitializeRow="wdgWorkbench_InitializeRow">
<ErrorTemplate>
There is some error. Please contact administrator.
</ErrorTemplate>
<EditorProviders>
<ig:DropDownProvider ID="ClientProvider">
<EditorControl runat="server" DisplayMode="DropDownList" TextField="ClientName" ValueField="ClientId"
DataSourceID="sdsClient" Width="150" />
</ig:DropDownProvider>
<ig:WebDateChooserProvider ID="DateInputProvider" />
<ig:DropDownProvider ID="DepartmentProvider">
<EditorControl ID="EditorControl1" runat="server" DisplayMode="DropDownList" TextField="Department"
ValueField="DepartmentId" DataSourceID="objDSDepartment" Width="100" DropDownOrientation="Default"
Font-Underline="false" EnableCachingOnClient="true" />
</EditorProviders>
<Columns>
<ig:TemplateDataField Header-Text="Preview" Key="Preview" Width="5%">
<ItemTemplate>
<asp:ImageButton ID="imgPreview" runat="server" CausesValidation="false" ImageUrl="~/images/view.jpg"
Height="16" Width="16" AlternateText="Preview" ImageAlign="Middle" ToolTip="Click to preview document"
CommandArgument='<%#Bind("TrialId") %>' OnCommand="imgPreview_Command" Style="cursor: auto;" />
</ItemTemplate>
<Header Text="View" />
</ig:TemplateDataField>
<ig:BoundDataField DataFieldName="MailId" Key="MailId" Width="8%">
<Header Text="Mail Id" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="Source" Key="Source" Width="15%">
<Header Text="Source" />
<ig:BoundDataField DataFieldName="FaxId" Key="FaxId" Width="10%">
<Header Text="Fax Number" />
<ig:BoundDataField DataFieldName="ReceivedDate" Key="ReceivedDate" Width="20%">
<Header Text="Received Date" />
<ig:BoundDataField DataFieldName="Client" Key="ClientId" Width="13%">
<Header Text="Client" />
<ig:BoundDataField DataFieldName="PageNum" Key="PageNum" Width="8%">
<Header Text="Page #" />
<ig:BoundDataField DataFieldName="Department" Key="DepartmentId" Width="16%">
<Header Text="Department" />
<ig:TemplateDataField Header-Text="Lock" Key="Lock" Width="5%">
<asp:ImageButton ID="imgLockUnlock" runat="server" CausesValidation="False" Height="16px"
Width="16px" OnDataBinding="imgLockUnLock_OnDataBinding" ImageAlign="Middle"
CommandArgument='<%#Bind("LockedFlag")%>' />
<Header Text="Lock" />
</Columns>
<Behaviors>
<ig:Activation />
<ig:Selection RowSelectType="Multiple" CellClickAction="Row" />
<ig:EditingCore>
<ig:CellEditing Enabled="true">
<EditModeActions EnableF2="true" EnableOnActive="true" MouseClick="Single" />
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="TrialId" ReadOnly="true" />
<ig:EditingColumnSetting ColumnKey="Preview" ReadOnly="true" />
<ig:EditingColumnSetting ColumnKey="ReceivedDate" EditorID="DateInputProvider" />
<ig:EditingColumnSetting ColumnKey="ClientId" EditorID="ClientProvider" />
<ig:EditingColumnSetting ColumnKey="DepartmentId" EditorID="DepartmentProvider" />
</ColumnSettings>
</ig:CellEditing>
</Behaviors>
</ig:EditingCore>
<ig:Paging Enabled="true" PageSize="16">
</ig:Paging>
<ig:Sorting SortingMode="Single" Enabled="true" />
<ClientEvents AJAXResponse="WebDataGridView_AJAXResponse" />
<ig:WebTextEditProvider ID="WebTextEditProvider1" />
</ig:WebDataGrid>
</div>
</
div>
<
asp:ObjectDataSource ID="objDSTrial" runat="server" SelectMethod="GetTrialData"
TypeName="TrialDemo" EnablePaging="True" SelectCountMethod="GetTrialDataCount"
StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maximumRows"
SortParameterName="sortBy" UpdateMethod="UpdateTrialData" EnableCaching="false">
<UpdateParameters>
<asp:Parameter Name="Source" Type="String" />
<asp:Parameter Name="ClientId" Type="Int32" />
</UpdateParameters>
asp:ObjectDataSource>
asp:SqlDataSource ID="sdsClient" runat="server" EnableCaching="true" ConnectionString="<%$ ConnectionStrings:APPConnectionString %>"
SelectCommand="SELECT [ClientID], [Name] as [ClientName] FROM [Client] WHERE ([Active] = @Active) ORDER BY [Name]">
<SelectParameters>
<asp:Parameter DefaultValue="true" Name="Active" Type="Boolean" />
</SelectParameters>
asp:SqlDataSource>
asp:ObjectDataSource ID="objDSDepartment" runat="server" EnableCaching="true" SelectMethod="GetTrialDepartment"
TypeName="TrialDemo"></asp:ObjectDataSource>
I don't see anything specific in your code, but I do have a working example that you can download in this sample:
http://dl.infragistics.com/community/aspnet/codesamples/na2010v1/na2010v1.zip
Best,
Craig
I stumbled over here googling for information on how to use the DropdownProvider correctly. I am unable to open the linked zip file, using WinZip Pro or 7zip. Botched upload / file corruption perhaps?
Edit: Found updated version of the samples through http://ko.infragistics.com/dotnet/netadvantage/aspnetdownloads.aspx#Downloads (NetAdvantage for Web Client 2010 Vol. 2 ASP.NET Samples), which contains a DropDownProvider example at 'Infragistics\NetAdvantage 2010.2\ASP.NET\Samples\WebFeatureBrowser\WebDataGrid\Editors'
Edit2: ...but that example doesn't deal with updates, and updates for me, as for the original poster, are not working correctly.