<telerik:RadTabStrip ID="RadTabStrip1" runat="server" AutoPostBack="false" OnClientLoad="ScrollToActiveTab" ScrollButtonsPosition="Middle" ScrollChildren="true" PerTabScrolling="true" Width="708">
</telerik:RadTabStrip>
Telerik.Web.UI.RadTab selectedTab = RadTabStrip1.FindTabByUrl(url);
if (selectedTab != null)
{
selectedTab.SelectParents();
selectedTab.Selected = true;
}
function ScrollToActiveTab(sender, eventArgs) {
var selectedTab = sender.get_selectedTab();
if (selectedTab != null) {
selectedTab.scrollIntoView();
}
}
tabs.getTab(this._currentTabIndex + _118) is undefined
RadComboBox.DataSource = dvBrowse.Table;
RadComboBox.DataBind();
protected void RadComboBox_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
{
e.Item.Value = ((DataRowView)e.Item.DataItem)[0].ToString();
e.Item.Text = ((DataRowView)e.Item.DataItem)[1].ToString();
}
this doesnt clear the old items in drop down.
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.InitInsertCommandName) |
| { |
| GetData(RadGrid1, "SELECT [RoleID],[Rolename] FROM [vw_UsersinRoles] WHERE [UserID] = " + this.DropDownList4.SelectedValue + " ORDER BY [Username]"); |
| } |
| else if (e.CommandName == RadGrid.UpdateCommandName) |
| { |
| } |
| else if (e.CommandName == RadGrid.DeleteCommandName) |
| { |
| SQLQuery("DELETE FROM [UsersinRoles] WHERE [UserID] = " + this.DropDownList4.SelectedValue + " AND [RoleID] = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["RoleID"].ToString()); |
| } |
| else if (e.CommandName == RadGrid.EditCommandName) |
| { |
| } |
| else if (e.CommandName == RadGrid.PerformInsertCommandName) |
| { |
| GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item.OwnerTableView.GetInsertItem(); |
| string RoleIDstring = (insertedItem["RadComboBox2"].Controls[0] as RadComboBox).SelectedValue; |
| int RoleID = Convert.ToInt16(RoleIDstring); |
| SQLQuery("INSERT INTO [UsersinRoles] ([UserID],[RoleID]) VALUES (" + this.DropDownList4.SelectedValue + "," + RoleID + ")"); |
| } |
| } |
| public static void GetData(RadGrid RadGrids, String SqlQuery) |
| { |
| DataTable dtTable = new DataTable(); |
| string conn = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ToString(); |
| SqlDataAdapter sqladp = new SqlDataAdapter(); |
| SqlConnection sqlconn = new SqlConnection(conn); |
| sqlconn.Open(); |
| try |
| { |
| string selectQuery = SqlQuery; |
| sqladp.SelectCommand = new SqlCommand(selectQuery, sqlconn); |
| sqladp.Fill(dtTable); |
| RadGrids.DataSource = dtTable; |
| RadGrids.DataBind(); |
| } |
| finally |
| { |
| sqlconn.Close(); |
| } |
| } |
| public static void SQLQuery(String SqlQuery) |
| { |
| string conn = ConfigurationManager.ConnectionStrings["SecurityConnectionString"].ToString(); |
| SqlConnection sqlconn = new SqlConnection(conn); |
| sqlconn.Open(); |
| try |
| { |
| SqlCommand cmd = new SqlCommand(SqlQuery, sqlconn); |
| cmd.ExecuteNonQuery(); |
| } |
| finally |
| { |
| sqlconn.Close(); |
| } |
| } |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" |
| AllowAutomaticDeletes="True" AllowPaging="True" EnableLinqExpressions="False" |
| OnItemCommand="RadGrid1_ItemCommand" AutoGenerateColumns="False" Width="310px" |
| BorderColor="Black" BorderWidth="1px" GridLines="None"> |
| <HeaderContextMenu EnableTheming="True"> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView DataKeyNames="RoleID" CommandItemSettings-AddNewRecordText="Add New Role" |
| CommandItemDisplay="Top"> |
| <CommandItemSettings AddNewRecordText="Add New Role"></CommandItemSettings> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridTemplateColumn UniqueName="DeleteColumn" ItemStyle-Width="16px" AllowFiltering="false"> |
| <HeaderStyle Width="16px" /> |
| <ItemTemplate> |
| <asp:ImageButton ID="imgbtnDelete" Width="14px" ToolTip="Delete Contact" runat="server" |
| CommandName="Delete" ImageUrl="~/images/recycle.jpg" OnClientClick="javascript:if(!confirm('This action will delete the selected contact. Are you sure?')){return false;}" /> |
| </ItemTemplate> |
| <ItemStyle Width="16px"></ItemStyle> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn HeaderText="Rolename" UniqueName="RolenameColumn"> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="RadComboBox2" AppendDataBoundItems="true" Height="200px" |
| runat="server" Skin="WebBlue" DataTextField="Rolename" DataValueField="RoleID" |
| DataSourceID="RCBaddnewrole" SelectedValue='<%# Bind("Rolename")%>'> |
| <Items> |
| <telerik:RadComboBoxItem Text="" Value="" /> |
| </Items> |
| </telerik:RadComboBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <%#Eval("Rolename")%> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <EditFormSettings ColumnNumber="3" CaptionFormatString="Edit details for User {0}" |
| CaptionDataField="RoleID"> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| <FormTemplate> |
| <asp:Table runat="server" ID="Table1" CellSpacing="1" CellPadding="1" Width="250" |
| border="0"> |
| <asp:TableRow> |
| <asp:TableCell ID="RCB2"> |
| <telerik:RadComboBox ID="RadComboBox2" runat="server" DataSourceID="RCBaddnewrole" |
| DataTextField="Rolename" DataValueField="RoleID"> |
| </telerik:RadComboBox> |
| </asp:TableCell> |
| </asp:TableRow> |
| <asp:TableRow> |
| <asp:TableCell> |
| <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' |
| runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> |
| </asp:Button> |
| <asp:Button CausesValidation="false" ID="btnEdit" Text="EditRole" runat="server" |
| CommandName="EditRole"></asp:Button> |
| <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" |
| CommandName="Cancel"></asp:Button></td> |
| </asp:TableCell> |
| </asp:TableRow> |
| </asp:Table> |
| </FormTemplate> |
| </EditFormSettings> |
| <NoRecordsTemplate> |
| No Records |
| </NoRecordsTemplate> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="RCBaddnewrole" runat="server" ConnectionString="<%$ ConnectionStrings:LawsonSecurityConnectionString %>" |
| SelectCommand="SELECT [Rolename], [RoleID] FROM [Roles] ORDER BY [Rolename]"> |
| </asp:SqlDataSource> |
| <div class="boxLunVen"> |
| <div class="boton1"><img alt='' src="../VistaStatic/images/Submenu/configurador1/semana.png" /></div> |
| <div class="time"> |
| <telerik:RadTimePicker ID="RadTimeInLunVen" runat="server" style="vertical-align:middle;" Width="60px" |
| StartTime="13:0:0" EndTime="22:31:00" Interval="0:30:0" Columns="2" TimeFormat="HH:mm" Culture="es-ES" |
| DateFormat="HH:mm" OnClientTimeSelected="OnTimeSelectedSem"> |
| </telerik:RadTimePicker> |
| <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ControlToValidate="RadTimeInLunVen" ValidationGroup="group1"></asp:RequiredFieldValidator> |
| </div> |
| <div class="clear"></div> |
| </div> |
| <div class="boxSamedi"> |
| <div class="boton1"><img alt='' src="../VistaStatic/images/Submenu/configurador1/weekend.png" /></div> |
| <div class="time"> |
| <telerik:RadTimePicker ID="RadTimeInSamedi" runat="server" style="vertical-align:middle;" Width="60px"> |
| <ClientEvents OnPopupClosing="OnPopupClosing" /> |
| <TimeView StartTime="13:0:0" EndTime="22:31:00" Interval="0:30:0" Columns="2" TimeFormat="HH:mm" Culture="en-US" OnClientTimeSelected="OnTimeSelected" runat="server"> |
| </TimeView> |
| <DateInput DateFormat="HH:mm" Culture="en-US" runat="server"></DateInput> |
| </telerik:RadTimePicker> |
| <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ControlToValidate="RadTimeInSamedi" ValidationGroup="group1"></asp:RequiredFieldValidator> |
| </div> |
| <div class="clear"></div> |
| </div> |