Ok I need a solution to a problem I keep running into. Basically, I want the edit and delete command columns to be the rightmost columns on my grid. However, when I use the advanced databinding technique, the edit and delete command options are in the leftmost columns.
I tried explicitly declaring my data columns in the <column> section of the masterTableView, but the only thing that does is cause the needDataSource event to duplicate the collumns.
Here is my grid declairation markup:
| <telerik:RadGrid ID="gvFirmInfo" runat="server" Width="550px"> |
| <MasterTableView |
| EditMode="PopUp" |
| CommandItemDisplay="Bottom" CommandItemStyle-BackColor = "#D8D8D8" |
| ShowHeader="true" ShowHeadersWhenNoRecords="false" NoMasterRecordsText="" |
| HeaderStyle-Font-Bold="true" HeaderStyle-BackColor ="#D8D8D8" |
| ItemStyle-BackColor="White" ItemStyle-BorderColor="#C9C4D1" |
| ItemStyle-BorderStyle="Solid" ItemStyle-BorderWidth="1px" |
| AlternatingItemStyle-BackColor="#E0E0E0" AlternatingItemStyle-BorderStyle="Solid" |
| AlternatingItemStyle-BorderWidth="0px" AlternatingItemStyle-BorderColor="#FFFFFF" |
| BorderColor="#C9C4D1" BorderWidth="1px" BorderStyle="Solid" |
| GridLines="None"> |
| <CommandItemTemplate> |
| <div style="text-align: right; padding: 8px;"> |
| <asp:Button ID="Button1" Text="Add Firm Location" |
| Runat="server" CommandName="InitInsert"></asp:Button> |
| </div> |
| </CommandItemTemplate> |
| <Columns> |
| <telerik:GridBoundColumn DataField="city" HeaderText="City"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="Country" HeaderText="Country"> |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="columnDelete" |
| ConfirmText="Are you sure you want to delete this record?"> |
| </telerik:GridButtonColumn> |
| <telerik:GridEditCommandColumn UniqueName="EditCommandColumn"> |
| </telerik:GridEditCommandColumn> |
| </Columns> |
| <EditFormSettings> |
| <!-- I have a custom edit form in here --> |
| </EditFormSettings> |
| </MasterTableView> |
| <ClientSettings> |
| <ClientEvents OnPopUpShowing="PopUpShowing" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
Here is my VB:
| Protected Sub gvFirmInfo_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles gvFirmInfo.NeedDataSource |
| Dim sqlString As String = "" |
| Dim sqlparam(2) As SqlParameter |
| Dim ds As New DataSet |
| Dim dr As SqlDataReader = Nothing |
| Try |
| SetParam(sqlparam(0), "@recId", Data.SqlDbType.Int, 4, m_rec_id) |
| SetParam(sqlparam(1), "@recType", Data.SqlDbType.Char, 2, m_rec_type) |
| sqlString = "SELECT ... FROM..." |
| ds = SqlHelper.ExecuteDataset(Conn, Data.CommandType.Text, sqlString, sqlparam) |
| gvFirmInfo.DataSource = ds |
| Catch ex As Exception |
| End Try |
| End Sub |
Most likely I have been ripping my hair out over something stupid.... any suggestions?