Using the latest version or RadGrid Prom.
I've got 2 SQL data sources on my page. The first binds the primary grid, and the second binds a dropdown that I have residing within a template column, in the edit portion.
The main form lists 3 columns, the buyer, the buyer code, and the current admin assigned to that buyer. What I want to do is have the dropdown show the value of the current admin that is listed on the main form, I just can't seem to get this to work.
Here is my current code:
And my SQL datasources
I've got 2 SQL data sources on my page. The first binds the primary grid, and the second binds a dropdown that I have residing within a template column, in the edit portion.
The main form lists 3 columns, the buyer, the buyer code, and the current admin assigned to that buyer. What I want to do is have the dropdown show the value of the current admin that is listed on the main form, I just can't seem to get this to work.
Here is my current code:
| <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None" |
| DataSourceID="SQL_BuyFromName" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" |
| AllowAutomaticUpdates="True" Skin="Default2006" Width="600px"> |
| <ExportSettings> |
| <Pdf PaperSize="Letter" FontType="Subset"></Pdf> |
| <Excel Format="Html"></Excel> |
| </ExportSettings> |
| <MasterTableView CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border" |
| TableLayout="Auto" CommandItemDisplay="None" DataSourceID="SQL_BuyFromName" DataKeyNames="id"> |
| <RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
| Visible="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
| Visible="False" Resizable="False"> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelImageUrl="Images\Cancel.gif" |
| EditImageUrl="Images\Edit.gif" UpdateImageUrl="Images\Update.gif" HeaderStyle-Width="30px"> |
| <HeaderStyle Width="30px"></HeaderStyle> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="BuyerName" FilterListOptions="VaryByDataType" |
| ForceExtractValue="None" HeaderText="Buyer Name" SortExpression="BuyerName" UniqueName="BuyerName" |
| HeaderStyle-Width="400px"> |
| <HeaderStyle Width="400px"></HeaderStyle> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="BuyerCode" FilterListOptions="VaryByDataType" |
| ForceExtractValue="None" HeaderText="Buyer Code" SortExpression="BuyerCode" UniqueName="BuyerCode" |
| HeaderStyle-Width="125px"> |
| <HeaderStyle Width="125px"></HeaderStyle> |
| </telerik:GridBoundColumn> |
| <telerik:GridTemplateColumn HeaderText="Current Admin" HeaderStyle-Width="130px"> |
| <ItemTemplate> |
| <asp:Label ID="lblName" Text='<%#Eval("CurrentAdmin") %>' runat="server"></asp:Label> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList ID="DropDownList1" runat="server" DataValueField='<%# Bind("id") %>' DataSourceID="SQL_Admins" DataTextField='<%# Bind("AdminName") %>' |
| AppendDataBoundItems="True"> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <EditFormSettings> |
| <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType"> |
| </EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
And my SQL datasources
| <asp:SqlDataSource ID="SQL_Admins" runat="server" ConnectionString="<%$ ConnectionStrings:Spiral_MainConnectionString %>" |
| SelectCommand="SELECT id, (Admin_First + ' ' + Admin_Last) as AdminName from DEV_ADMIN_INFORMATION WHERE ACTIVE = '1' ORDER BY AdminName"> |
| </asp:SqlDataSource> |
| <asp:SqlDataSource ID="SQL_BuyFromName" runat="server" ConnectionString="<%$ ConnectionStrings:Spiral_MainConnectionString %>" |
| SelectCommand="SELECT b.id as id, b.HdrBuyFromBP as BuyerCode, b.HdrBuyFromBPName as BuyerName, b.adminNo, (d.Admin_First + ' ' + d.Admin_Last) as CurrentAdmin from DEV_BUY_FROM_NAME b LEFT JOIN DEV_ADMIN_INFORMATION d ON d.id = b.adminNo WHERE b.ACTIVE = '1' ORDER BY BuyerName" |
| UpdateCommand="UPDATE DEV_BUY_FROM_NAME set adminNo = @adminNo WHERE (id = @id)"> |
| </asp:SqlDataSource> |
