| Protected Sub fabricGrid_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles fabricGrid.ItemDataBound |
| If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then |
| Dim editedItem As GridEditFormItem = CType(e.Item, GridEditFormItem) |
| ' Add supplier combobox |
| Dim supplierCombo As New RadComboBox |
| supplierCombo.ID = "supplierCombo" |
| Dim objPlan As New lucyPlanBizObject.plan _ |
| (Application("ConnectString")) |
| Dim dsResult As DataSet |
| dsResult = objPlan.getFabricSupplier("active") |
| supplierCombo.DataSource = dsResult.Tables(0) |
| supplierCombo.DataValueField = "fabricSupplierID" |
| supplierCombo.DataTextField = "supplier" |
| supplierCombo.DataBind() |
| supplierCombo.SelectedValue = 2 |
| editedItem("supplier").Controls.Add(supplierCombo) |
| Dim textbox As TextBox |
| textbox = CType(editedItem("supplier").Controls(0), TextBox) |
| textbox.Visible = False |
| textbox.CssClass = "smalltext" |
| End If |
| End Sub |
| Protected Sub fabricGrid_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles fabricGrid.UpdateCommand |
| Dim i As Integer |
| If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then |
| Dim editedItem As GridEditFormItem = CType(e.Item, GridEditFormItem) |
| Dim textbox As TextBox |
| Dim supplierCombo As RadComboBox |
| Dim fabricID As String |
| Dim planStyleColorFabricID As Integer |
| Dim fabricSupplierID As Integer |
| planStyleColorFabricID = CInt(e.Item.OwnerTableView.Items(e.Item.ItemIndex).Cells(3).Text) |
| fabricID = e.Item.OwnerTableView.Items(e.Item.ItemIndex).Cells(4).Text |
| fabricSupplierID = CInt(e.Item.OwnerTableView.Items(e.Item.ItemIndex).Cells(6).Text) |
| textbox = CType(editedItem("fabricID").Controls(0), TextBox) |
| supplierCombo = CType(editedItem("supplier").Controls(1), RadComboBox) 'supplierCombo = nothing because RadComboBox control is nowhere to be found!!! |
| End If |
| End Sub |
<
script type="text/javascript">
function openRadWin() {
radopen("ViewSiteGroupSites_Popup.aspx,
"RadWindow1");
}
</script>
<
telerik:RadWindowManager ID="RadWindowManager1" runat="server" Modal="true" >
<Windows>
<telerik:RadWindow
id="RadWindow1"
runat="server"
showcontentduringload="false"
width="500px"
height="500px"
VisibleTitlebar="false"
VisibleStatusbar="false"
>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
GridBoundColumn
boundColumn = new GridBoundColumn();
TargetGrid.MasterTableView.Columns.Add(boundColumn);
After I've added all of the columns I need to set the sort order programmatically. So let's say I add 3 columns: ID, name and address. Now I need to set the grid to sort ascending on Name. How can I do that?
Thanks in advance!
Ben
| <telerik:RadGrid ID="ContentsRadGrid" runat="server" |
| GridLines="None" |
| OnNeedDataSource="ContentsRadGrid_NeedDataSource" |
| ondeletecommand="ContentsRadGrid_DeleteCommand"> |
| <MasterTableView AutoGenerateColumns="false"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Quantity" DataField="Quantity" /> |
| <telerik:GridBoundColumn HeaderText="NDC" DataField="TheDrug.Ndc" /> |
| <telerik:GridBoundColumn HeaderText="Name" DataField="TheDrug.DrugName" /> |
| <telerik:GridBoundColumn HeaderText="Size" DataField="TheDrug.DrugSize" /> |
| <telerik:GridBoundColumn HeaderText="Strength" DataField="TheDrug.DrugStrength" /> |
| <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" |
| ConfirmText="Delete medication from kit list?" /> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <telerik:RadGrid ID="RadGrid1" runat="server" |
| GridLines="None" |
| OnNeedDataSource="RadGrid1_NeedDataSource" |
| ondeletecommand="ContentsRadGrid_DeleteCommand"> |
| <MasterTableView AutoGenerateColumns="false"> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Quantity" DataField="Quantity" Visible="false" /> |
| </Columns> |
| <ItemTemplate> |
| <table style="width:100%;"> |
| <tr> |
| <td rowspan="2" style="text-align:center; width:15%"> |
| Qty:<br /> |
| <%# Eval("Quantity") %> |
| </td> |
| <td colspan="2" style="white-space:nowrap;"> |
| <%# Eval("TheDrug.Ndc.NdcString") %> |
| <span style="font-weight:bold;"><%# Eval("TheDrug.DrugName") %></span> |
| </td> |
| <td rowspan="2" style="text-align:center; width:10%"> |
| DELETE LINK GOES HERE |
| </td> |
| </tr> |
| <tr> |
| <td style="white-space:nowrap;"> |
| Strength: |
| <%# Eval("TheDrug.DrugStrength") %> |
| </td> |
| <td style="white-space:nowrap;"> |
| Size: |
| <%# Eval("TheDrug.DrugSize") %> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </MasterTableView> |
| </telerik:RadGrid> |