| <telerik:RadSplitter ID="Splitter_bottom" runat="server" LiveResize="true" ResizeMode="AdjacentPane" |
| Width="100%" Orientation="Vertical" Skin="SampleSpliter" EnableEmbeddedSkins="false" |
| ResizeWithBrowserWindow="true" ResizeWithParentPane="false" SplitBarsSize="20" |
| BorderSize="0" BorderStyle="None" BorderWidth="0px" Height="100%"> |
| <telerik:RadPane ID="Pane_contacts" Scrolling="None" runat="server" Width="16%" Height="100%" |
| BorderWidth="0px" BorderStyle="none" EnableEmbeddedBaseStylesheet="False"> |
| <telerik:RadPanelBar ID="PanelBar_Contacts" runat="server" AllowCollapseAllItems="true" |
| ExpandMode="FullExpandedItem" Height="100%" Width="100%" Skin="Vista" CollapseAnimation-Type="InQuart"> |
| <Items> |
| <telerik:RadPanelItem Expanded="true" ImageUrl="Img/contacts.gif" Text="Contacts"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Value="ContactsSection" Width="100%" Height="100%"> |
| <ItemTemplate> |
| <telerik:RadSplitter ID="Splitter_TxtContacts" runat="server" LiveResize="true" ResizeMode="AdjacentPane" |
| Width="100%" Skin="SampleSpliter" EnableEmbeddedSkins="false" ResizeWithBrowserWindow="true" |
| ResizeWithParentPane="false" BorderSize="0" BorderStyle="None" BorderWidth="0px" |
| Height="100%"> |
| <telerik:RadPane ID="Pane_TxtContacts" Scrolling="None" runat="server" Width="100%" |
| Height="100%" BorderWidth="0px" BorderStyle="none" EnableEmbeddedBaseStylesheet="False"> |
| <asp:TextBox ID="txt_contact_name" onkeyup="KeyUp();" runat="server" AutoCompleteType="Disabled" |
| Text="Type here to search" onblur="DefaultText(this, event);" onfocus="DefaultText(this, event);" |
| Style="color: #BFC0BD"></asp:TextBox> |
| <telerik:RadGrid ID="Grid_contacts" AllowPaging="true" PageSize="25" Skin="Telerik" |
| runat="server" OnNeedDataSource="Grid_contacts_NeedDataSource" Width="100%" AutoGenerateColumns="false" |
| HorizontalAlign="NotSet" OnUpdateCommand="Grid_contacts_UpdateCommand" OnInsertCommand="Grid_contacts_InsertCommand" |
| OnDeleteCommand="Grid_contacts_DeleteCommand" OnSelectedIndexChanged="Grid_contacts_SelectedIndexChanged" |
| OnItemDataBound="Grid_contacts_ItemDataBound" OnItemCommand="Grid_contacts_ItemCommand"> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="ContactID" EditMode="InPlace"> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" |
| HeaderText="Edit"> |
| <ItemStyle CssClass="MyImageButton" /> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName" |
| ColumnEditorID="Grid_contactsTextBox_FirstName"> |
| </telerik:GridBoundColumn> |
| <%-- <telerik:GridTemplateColumn> |
| <ItemTemplate> |
| <asp:LinkButton runat="server" ID="btnGrid_details" Text="Details" OnClick="btnGrid_details_OnClick"></asp:LinkButton> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn>--%> |
| <telerik:GridButtonColumn UniqueName="GridDetails" Text="Details" CommandName="Select" |
| HeaderText="View Details" /> |
| <%--<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" |
| ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" |
| UniqueName="DeleteColumn"> |
| <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> |
| </telerik:GridButtonColumn>--%> |
| </Columns> |
| <ExpandCollapseColumn Visible="False"> |
| <HeaderStyle Width="10px" /> |
| </ExpandCollapseColumn> |
| <RowIndicatorColumn Visible="False"> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <EditFormSettings> |
| <EditColumn UniqueName="EditCommandColumn1"> |
| </EditColumn> |
| </EditFormSettings> |
| </MasterTableView> |
| <%-- <ClientSettings> |
| <ClientEvents OnRowDblClick="MakeVisibleContacts();" /></ClientSettings>--%> |
| </telerik:RadGrid> |
| <telerik:GridTextBoxColumnEditor ID="Grid_contactsTextBox_FirstName" runat="server" /> |
| </telerik:RadPane> |
| <telerik:RadPane ID="Pane_NotesSection" runat="server" Scrolling="None" Width="100%" |
| Height="100%" BorderWidth="0px" BorderStyle="none" EnableEmbeddedBaseStylesheet="False" |
| Visible="false"> |
| <table class="style1" width="100%" style="height: 100%"> |
| <tr> |
| <td align="center"> |
| <asp:Label ID="lbl_name" runat="server" Text="Label" Font-Bold="True"></asp:Label> |
| </td> |
| <td align="center"> |
| <asp:Image ID="ProfileImage" runat="server" Width="40px" Height="50px" BorderColor="#FF3300" |
| BorderStyle="Solid" /> |
| <br /> |
| <asp:LinkButton ID="LinkButtonShowUpload" runat="server" Text="Upload Photo" OnClick="LinkButtonShowUpload_Click" /> |
| <asp:Panel runat="server" ID="UpdateImagePanel" Style="display: none" BorderColor="Aqua"> |
| <telerik:RadUpload ID="RadUpload1" runat="server" Skin="Sunset" ControlObjectsVisibility="none" |
| EnableAjaxSkinRendering="true" /> |
| <asp:Button runat="server" ID="BtnUploadImage" Text="Submit" OnClick="BtnUploadImage_Click" |
| OnClientClick="return CancelAjax()" /> |
| <asp:Button runat="server" ID="BtnCancelUpload" Text="Cancel" OnClick="BtnCancelUpload_Click"> |
| </asp:Button> |
| </asp:Panel> |
| </td> |
| <td align="center"> |
| <asp:Label ID="lbl_phone" runat="server" Text="Label" Font-Bold="True"></asp:Label> |
| </td> |
| </tr> |
| <tr> |
| <td align="center"> |
| <asp:Label ID="lbl_town" runat="server" Text="Label" Font-Bold="True"></asp:Label> |
| </td> |
| <td> |
| |
| </td> |
| <td align="center"> |
| <asp:Label ID="lbl_email" runat="server" Text="Label" Font-Bold="True"></asp:Label> |
| </td> |
| </tr> |
| <tr> |
| <td class="style2" colspan="3"> |
| <telerik:RadEditor ID="txt_NotesCurrent" runat="server" Height="100%" Skin="Office2007" |
| Width="98%" SkinID="BasicSetOfTools" EditModes="Design"> |
| <Tools> |
| <telerik:EditorToolGroup> |
| <telerik:EditorTool Name="FindAndReplace" Enabled="True" /> |
| <%-- <telerik:EditorTool Name="ForeColor" Enabled="true" /> |
| <telerik:EditorTool Name = "Paste" Enabled ="true" />--%> |
| <telerik:EditorTool Name="BackColor" Enabled="true" /> |
| </telerik:EditorToolGroup> |
| </Tools> |
| <Content> |
| </Content> |
| </telerik:RadEditor> |
| <%-- <asp:TextBox ID="txt_NotesCurrent" runat="server" Height="200px" |
| TextMode="MultiLine" Width="98%" ></asp:TextBox>--%> |
| <%--<telerik:RadTextBox ID="txt_NotesCurrent" runat="server" Height="200px" |
| ShouldResetWidthInPixels="False" TextMode="MultiLine" Width="100%" > |
| </telerik:RadTextBox>--%> |
| </td> |
| </tr> |
| <tr> |
| <td align="center"> |
| <asp:Button ID="btn_Save" runat="server" Text="Ok" OnClick="btn_Save_Click" /> |
| </td> |
| <td align="center"> |
| <asp:Button ID="btn_Cancel" runat="server" Text="Cancel" OnClick="btn_Cancel_Click" /> |
| </td> |
| <td align="center"> |
| <asp:Button ID="btn_Apply" runat="server" Text="Apply" OnClick="btn_Apply_Click" /> |
| </td> |
| </tr> |
| </table> |
| </telerik:RadPane> |
| </telerik:RadSplitter> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem Expanded="false" ImageUrl="Img/contacts.gif" Text="Orders"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Value="Orders" Width="100%" > |
| <ItemTemplate> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelBar> |
| </telerik:RadPane> |
| <telerik:RadSplitBar ID="SplitBar_contacts" runat="server" CollapseMode="Both" Width="20px" |
| Height="100%" /> |
| <telerik:RadPane ID="Pane_today" Scrolling="None" runat="server" Width="26%" Height="100%" |
| BorderWidth="0px" BorderStyle="none" EnableEmbeddedBaseStylesheet="False"> |
| </telerik:RadPane> |
| <telerik:RadSplitBar ID="SplitBar_Today" runat="server" CollapseMode="Both" Width="20px" |
| Height="100%" /> |
| <telerik:RadPane ID="Pane_Scheduler" Scrolling="None" runat="server" Width="56%" |
| Height="100%" BorderWidth="0px" BorderStyle="none" EnableEmbeddedBaseStylesheet="False"> |
| <telerik:RadPanelBar ID="PanelBar_Scheduler" runat="server" ExpandMode="FullExpandedItem" |
| Skin="Vista" Height="100%" Width="100%" AllowCollapseAllItems="true"> |
| <CollapseAnimation Type="InOutQuint" /> |
| <Items> |
| <telerik:RadPanelItem Expanded="True" ImageUrl="Img/schedule.png" Text="Scheduler"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Height="96%" Value="WeekScheduler"> |
| <ItemTemplate> |
| <telerik:RadSplitter ID="Splitter_Scheduler" runat="server" Height="98%" Width="98%" |
| LiveResize="true" ResizeMode="AdjacentPane" Orientation="Horizontal" Skin="SBM_Spliter" |
| EnableEmbeddedSkins="false" ResizeWithBrowserWindow="true" SplitBarsSize="20" |
| BorderSize="0" BorderStyle="None" BorderWidth="0px" ResizeWithParentPane="false" |
| VisibleDuringInit="false"> |
| <telerik:RadPane ID="Pane_calender" runat="server" EnableEmbeddedBaseStylesheet="False" |
| EnableEmbeddedScripts="false" Scrolling="None" Height="10%"> |
| <%-- <telerik:RadCalendar ID="RadCalendar1" runat="server" Font-Names="Arial, Verdana, Tahoma" |
| ForeColor="Black" Style="border-color: #ececec" Height="10%"> |
| </telerik:RadCalendar> --%> |
| </telerik:RadPane> |
| <telerik:RadSplitBar ID="SplitBar_calendar" runat="server" CollapseMode="Both" Width="19px" /> |
| <telerik:RadPane ID="Pane_WeekScheduler" runat="server" EnableEmbeddedBaseStylesheet="False" |
| EnableEmbeddedScripts="false" Scrolling="None" CssClass="ApplyPosition"> |
| <telerik:RadScheduler ID="RadScheduler1" runat="server" DataKeyField="ID" DataStartField="Start" |
| DataSubjectField="Subject" DataEndField="End" Skin="Vista" Width="100%"> |
| </telerik:RadScheduler> |
| </telerik:RadPane> |
| </telerik:RadSplitter> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| <telerik:RadPanelItem runat="server" Text="ToDo's"> |
| <Items> |
| <telerik:RadPanelItem runat="server" Value="Todo" Height="96%"> |
| <ItemTemplate> |
| </ItemTemplate> |
| </telerik:RadPanelItem> |
| </Items> |
| </telerik:RadPanelItem> |
| </Items> |
| <ExpandAnimation Type="None" /> |
| </telerik:RadPanelBar> |
| </telerik:RadPane> |
| <%--<telerik:RadSplitBar ID="RadSplitBar4" runat="server" CollapseMode="Forward" Width="20px" |
| Height="100%" />--%> |
| </telerik:RadSplitter> |
| <telerik:RadAjaxManager runat="server" ID="ajax_manager" OnAjaxRequest="ajax_manager_AjaxRequest"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="Grid_contacts"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="Grid_contacts" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| <%--<telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" />--%> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="ajax_manager"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="Grid_contacts" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="Grid_contacts"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="btn_Save"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="btn_Cancel"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="LinkButtonShowUpload"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="LinkButtonShowUpload" /> |
| <telerik:AjaxUpdatedControl ControlID="UpdateImagePanel" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| <telerik:AjaxSetting AjaxControlID="BtnCancelUpload"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="LinkButtonShowUpload" /> |
| <telerik:AjaxUpdatedControl ControlID="UpdateImagePanel" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" Skin="Vista" /> |
| # region Grid Contacts Search Fill |
| // Grid Contacts Search Fill |
| protected void Grid_contacts_InsertCommand(object source, GridCommandEventArgs e) |
| { |
| FileStream fs = new FileStream("./Img/NoImage.jpg", FileMode.Open, FileAccess.Read); |
| BinaryReader br = new BinaryReader(fs); |
| byte[] photo = br.ReadBytes((int)fs.Length); |
| br.Close(); |
| fs.Close(); |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| //GridTextBoxColumnEditor itemupdate = e.Item.DataItem as GridTextBoxColumnEditor; |
| //Get the primary key value using the DataKeyValue. |
| //int ContactID = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ContactID"].ToString()); |
| string FirstName = (editedItem.EditManager.GetColumnEditor("FirstName") as GridTextBoxColumnEditor).Text; |
| //string FirstName = (itemupdate.FindControl("Grid_contactsTextBox_FirstName") as GridTextBoxColumnEditor).Text; |
| string InsertSQL = "Insert into Contacts(FirstName,AdminID,Photo) Values('" + FirstName + "',1,@img)"; |
| SqlConnection con = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(InsertSQL, con); |
| cmd.Parameters.Add("@img", SqlDbType.Image, photo.Length).Value = photo; |
| int flag; |
| try |
| { |
| con.Open(); |
| flag = cmd.ExecuteNonQuery(); |
| } |
| catch (Exception Error) |
| { |
| } |
| finally |
| { |
| con.Close(); |
| } |
| } |
| protected void Grid_contacts_DeleteCommand(object source, GridCommandEventArgs e) |
| { |
| } |
| protected void Grid_contacts_UpdateCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| //GridTextBoxColumnEditor itemupdate = e.Item.DataItem as GridTextBoxColumnEditor; |
| //Get the primary key value using the DataKeyValue. |
| int ContactID = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ContactID"].ToString()); |
| string FirstName = (editedItem.EditManager.GetColumnEditor("FirstName") as GridTextBoxColumnEditor).Text; |
| //string FirstName = (itemupdate.FindControl("Grid_contactsTextBox_FirstName") as GridTextBoxColumnEditor).Text; |
| string UpdateSQL = "Update Contacts set FirstName='" + FirstName + "' where ContactID =" + ContactID; |
| SqlConnection con = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(UpdateSQL, con); |
| int flag; |
| try |
| { |
| con.Open(); |
| flag = cmd.ExecuteNonQuery(); |
| } |
| catch (Exception Error) |
| { |
| } |
| finally |
| { |
| con.Close(); |
| } |
| } |
| protected void Grid_contactsTextBox_FirstName_Load(object sender, EventArgs e) |
| { |
| } |
| protected void Grid_contacts_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
| { |
| RadGrid Grid_contacts = (RadGrid)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("Grid_contacts"); |
| Grid_contacts.DataSource = GetDataTable(); |
| } |
| // string connectionString = WebConfigurationManager.ConnectionStrings["SchedulerConnectionString"].ConnectionString; |
| private DataTable GetDataTable() |
| { |
| RadGrid Grid_contacts = (RadGrid)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("Grid_contacts"); |
| TextBox txt_contact_name = (TextBox)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("txt_contact_name"); |
| DataTable datatable; |
| if (txt_contact_name.Text.Trim() != "") |
| { |
| Grid_contacts.Visible = true; |
| string selectSQL = "SELECT ContactID,FirstName FROM [Contacts] Where FirstName LIKE '%" + txt_contact_name.Text + "%'"; |
| SqlConnection con = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(selectSQL, con); |
| //SqlDataReader reader; |
| SqlDataAdapter da = new SqlDataAdapter(selectSQL, connectionString); |
| datatable = new DataTable(); |
| //Pane_contacts.Width = Unit.Percentage(40.0); |
| //Pane_today.Width = Unit.Percentage(20.0); |
| //Pane_Scheduler.Width = Unit.Percentage(40.0); |
| //da.Fill(datatable); |
| //OleDbConnection connection1 = new OleDbConnection(); |
| //OleDbDataAdapter adapter1 = new OleDbDataAdapter(); |
| //adapter1.SelectCommand = new OleDbCommand(query, connection1); |
| //DataTable table1 = new DataTable(); |
| //connection1.Open(); |
| try |
| { |
| //adapter1.Fill(table1); |
| da.Fill(datatable); |
| } |
| finally |
| { |
| //connection1.Close(); |
| } |
| } |
| else |
| { |
| Grid_contacts.Visible = false; |
| string selectSQL = "SELECT ContactID,FirstName FROM [Contacts] Where FirstName= ' '"; |
| SqlConnection con = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(selectSQL, con); |
| //SqlDataReader reader; |
| SqlDataAdapter da = new SqlDataAdapter(selectSQL, connectionString); |
| datatable = new DataTable(); |
| da.Fill(datatable); |
| } |
| return datatable; |
| } |
| protected void Grid_contacts_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| TextBox txt_contact_name = (TextBox)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("txt_contact_name"); |
| if (e.Item.OwnerTableView.IsItemInserted && e.Item is GridEditableItem) |
| { |
| GridEditableItem item = (GridEditableItem)e.Item; |
| try |
| { |
| if (txt_contact_name.Text == "Type here to search") |
| { |
| TextBox textbox = (TextBox)item["FirstName"].Controls[0]; // Get the textbox |
| textbox.Text = ""; |
| } |
| else |
| { |
| TextBox textbox = (TextBox)item["FirstName"].Controls[0]; // Get the textbox |
| textbox.Text = txt_contact_name.Text; // Set the textbox value |
| } |
| } |
| catch (Exception error) |
| { |
| } |
| } |
| } |
| protected void Grid_contacts_SelectedIndexChanged(object sender, EventArgs e) |
| { |
| //Pane_contacts.Width = Unit.Percentage(40.0); |
| //Pane_today.Width = Unit.Percentage(20.0); |
| //Pane_Scheduler.Width = Unit.Percentage(40.0); |
| //Pane_TxtContacts.Visible = false; |
| //Pane_NotesSection.Visible = true; |
| //LoadImage(ContactID); |
| //Pane_Scheduler.Visible = false; |
| // string i = Grid_contacts.SelectedValue.ToString(); |
| //Splitter_ContactSearch.Visible = false; |
| //RadPane panewidth = new RadPane(); |
| //panewidth = Pane_ContactSearch; |
| //panewidth.Width = Unit.Percentage(40.0); |
| //Splitter_ContactNotes.Visible = true; |
| //Pane_ContactSearch.Visible = false; |
| //Pane_NotesTab.Visible = true; |
| //btn_adminSettings.Width = Unit.Pixel(5); |
| ////Pane_ContactsPanel.Width = Unit.Percentage(40.0); |
| //Pane_SchedulerPanel.Width = Unit.Percentage(30.0); |
| //Pane_TodayPanel.Width = Unit.Percentage(30.0); |
| } |
| # endregion |
| protected void ajax_manager_AjaxRequest(object sender, AjaxRequestEventArgs e) |
| { |
| RadGrid Grid_contacts = (RadGrid)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("Grid_contacts"); |
| if (e.Argument.IndexOf("FilterGrid") != -1) |
| { |
| //txt_contact_name.Focus(); |
| Grid_contacts.Rebind(); |
| //txt_contact_name.Focus(); |
| } |
| } |
| protected void Grid_contacts_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| RadPane Pane_NotesSection = (RadPane)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("Pane_NotesSection"); |
| RadPane Pane_TxtContacts = (RadPane)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("Pane_TxtContacts"); |
| Label lbl_email = (Label)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("lbl_email"); |
| Label lbl_name = (Label)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("lbl_name"); |
| Label lbl_phone = (Label)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("lbl_phone"); |
| Label lbl_town = (Label)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("lbl_town"); |
| Image ProfileImage = (Image)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("ProfileImage"); |
| RadEditor txt_NotesCurrent = (RadEditor)PanelBar_Contacts.FindItemByValue("ContactsSection").FindControl("txt_NotesCurrent"); |
| if (e.CommandName == "Select") |
| { |
| Pane_contacts.Width = Unit.Percentage(40.0); |
| Pane_today.Width = Unit.Percentage(20.0); |
| Pane_Scheduler.Width = Unit.Percentage(40.0); |
| Pane_TxtContacts.Visible = false; |
| Pane_NotesSection.Visible = true; |
| GridDataItem editedItem = e.Item as GridDataItem; |
| int ContactID = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ContactID"].ToString()); |
| string selectSQL = "Select * from Contacts where ContactID = " + ContactID; |
| SqlConnection con = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(selectSQL, con);//SqlDataReader reader; |
| SqlDataAdapter da = new SqlDataAdapter(selectSQL, connectionString); |
| DataTable datatable = new DataTable(); |
| try |
| { |
| //adapter1.Fill(table1); |
| da.Fill(datatable); |
| lbl_email.Text = datatable.Rows[0]["Email"].ToString(); |
| lbl_name.Text = datatable.Rows[0]["FirstName"].ToString() + " " + datatable.Rows[0]["LastName"].ToString(); |
| lbl_phone.Text = datatable.Rows[0]["Phone"].ToString(); |
| lbl_town.Text = datatable.Rows[0]["Town"].ToString(); |
| //txt_NotesCurrent.Text = datatable.Rows[0]["NotesCurrent"].ToString(); |
| LoadImage(ContactID); |
| txt_NotesCurrent.Content = datatable.Rows[0]["NotesCurrent"].ToString(); |
| ProfileImage.AlternateText = ContactID.ToString(); |
| } |
| finally |
| { |
| //connection1.Close(); |
| } |
| //LoadImage(ContactID); |
| //int gridrowid = e.Item.RowIndex; |
| //int id = Grid_contacts.MasterTableView. |
| } |
| } |
Hi Telerik Team,
How to set the height of the RadSliding Pane.The sliding pane occupying whole splitter size.I tried giving height property but still its occupying whole splitter size.
Please help me to solve this issue.
Hi All,
I am using RadGrid in my application. I am fetching around 10 to 15 columns from the database and filling the RadGrid. As per the requirement, i have to display only specific columns in the Grid.
For this, I am hiding the columns from the user using javascript, which would not be displayed to the user.
I should also have to hide these columns in header context menu of RadGrid.
Can anyone please help to solve this issue?
Thanks,
KKB.
Modal
="true"
However the entire window including the pop up window greys out. Any one have a solution for this.
Thanks
function OnClientDockPositionChanged(sender, args) {
alert(sender.get_dockZoneID());
alert(sender.get_uniqueID());
alert(sender.get_collapsed());
alert(sender.get_closed());
}
Do you have an example when the state of the docks is saved and loaded using web service call through AJAX's
PageMethods?
| C# |
| [WebMethod] |
| public static RadTreeNodeData[] LoadNodes(RadTreeNodeData node) // called each time a node is expanded |
| { |
| AttributeService.Attribute atts = new AttributeService.Attribute(); |
| List<RadTreeNodeData> result = new List<RadTreeNodeData>(); |
| DataSet ds = new DataSet(), ads = new DataSet(); |
| DataTable data = new DataTable(), attributeData = new DataTable(); |
| int WebP_Id = Int32.Parse(HttpContext.Current.Session["WebPID"].ToString()); |
| ArrayList RadNodeChanged = new ArrayList(); |
| ds = atts.GetChildrenByWebpId(WebP_Id, Convert.ToInt32(node.Value)); // gets the children for a specific item |
| data = ds.Tables[0]; |
| foreach (DataRow row in data.Rows) |
| { |
| RadTreeNodeData childNode = new RadTreeNodeData(); |
| childNode.Text = row["AttributeName"].ToString(); // adds the name and the text to "childNode" |
| childNode.Value = row["Attribute_Id"].ToString(); |
| if (atts.GetAllChildren(Convert.ToInt32(childNode.Value)).Tables[0].Rows.Count > 0) |
| { |
| childNode.ExpandMode = TreeNodeExpandMode.WebService; |
| } |
| //can code go here to make the color of the node red when the parent is expanded? |
| //attributeData = atts.GetAttributes(WebP_Id).Tables[0]; |
| //foreach (DataRow dr in attributeData.Rows) |
| //{ |
| // if (String.Compare(dr["AttributeId"].ToString(), childNode.Value) == 0) |
| // { |
| // childNode.Attributes["ForeColor"] = System.Drawing.Color.Red; |
| // } |
| //} //doesn't work |
| result.Add(childNode); |
| } |
| return result.ToArray(); |
| } |
| private static void LoadRootAttributeNodes(RadTreeView treeView, TreeNodeExpandMode expandMode) |
| { |
| AttributeService.Attribute attser = new AttributeService.Attribute(); // function is called to set the origin nodes |
| int WebP_Id = Int32.Parse(HttpContext.Current.Session["WebPID"].ToString()); |
| DataSet ds = new DataSet(); |
| ArrayList Cat = new ArrayList(); |
| DataTable dt = new DataTable(); |
| ds = attser.GetChildrenByWebpId(WebP_Id, 0); // zero being for the high level parent nodes |
| dt = ds.Tables[0]; |
| foreach (DataRow row in dt.Rows) |
| { |
| RadTreeNode node = new RadTreeNode(); |
| node.Text = row["AttributeName"].ToString(); |
| node.Value = row["Attribute_Id"].ToString(); |
| node.ExpandMode = expandMode; |
| treeView.Nodes.Add(node); |
| } |
| } |
| protected void AttributesTree_HandleDrop(object sender, RadTreeNodeDragDropEventArgs e) |
| { //drag and drop function, when an item is released from the tree, this function will be called |
| RadTreeNode sourceNode = e.SourceDragNode, destNode = e.DestDragNode; |
| RadTreeViewDropPosition dropPosition = e.DropPosition; |
| AttributeService.Attribute atts = new AttributeService.Attribute(); |
| ArrayList deletedCat = new ArrayList(); |
| DataSet ds = new DataSet(); |
| DataTable dt = (DataTable)Session["AttributesTable"]; |
| bool existsInList = false; |
| Session["TreeView"] = AttributeTree; |
| foreach (GridDataItem dataItem in CurrentAttributesList.Items) |
| { |
| if (dataItem.ForeColor == System.Drawing.Color.Red) |
| { |
| deletedCat.Add(dataItem["AttributeId"].Text); |
| } |
| } |
| foreach (RadTreeNode node in e.DraggedNodes) |
| { |
| existsInList = false; |
| foreach ( GridDataItem item in CurrentAttributesList.Items ) |
| { |
| if (item["AttributeId"].Text == node.Value) |
| { |
| existsInList = true; |
| } |
| } |
| if (existsInList) |
| { |
| Master.AttributePublishErrorMessage = "Please use an attribute that is not in the list"; // duplicate item |
| } |
| else |
| { |
| ds = atts.GetAttributeByAttributeID(Convert.ToInt32(node.Value)); |
| if (ds.Tables.Count > 0) |
| { |
| foreach (DataRow dr in ds.Tables[0].Rows) |
| { |
| if (String.Compare(dr["Parent_ID"].ToString(), "0") == 0) |
| { |
| Master.AttributePublishErrorMessage = "Please use the lowest possible, non-parent attribute available."; |
| } |
| else |
| { |
| dt.Rows.Add(dr["Attribute_ID"], dr["AttributeName"], dr["AttributePath"]); |
| foreach (RadTreeNode currentnode in AttributeTree.SelectedNodes) |
| { |
| currentnode.ForeColor = System.Drawing.Color.Red; |
| RadTreeNodeChanged.Add(currentnode.Value); |
| } |
| } |
| } |
| } |
| } |
| } |
| Session["AttributesTable"] = dt; |
| CurrentAttributesList.DataSource = dt; |
| CurrentAttributesList.DataBind(); |
| for (int i = 0; i < CurrentAttributesList.Items.Count; i++) |
| { |
| for (int j = 0; j < deletedCat.Count; j++) |
| { |
| if (CurrentAttributesList.Items[i]["AttributeId"].Text == deletedCat[j].ToString()) |
| { |
| CurrentAttributesList.Items[i].Font.Strikeout = true; |
| CurrentAttributesList.Items[i].ForeColor = System.Drawing.Color.Red; |
| } |
| } |
| } |
| } |
| public void CurrentAttributes(int webp_id) |
| { |
| AttributeService.Attribute atts = new AttributeService.Attribute(); |
| DataSet attributes = atts.GetAttributes(webp_id); |
| DataTable attributeData = attributes.Tables[0]; |
| CurrentAttributesList.DataSource = attributeData; |
| CurrentAttributesList.DataBind(); |
| Session["AttributesTable"] = attributeData; |
| } |
| protected void CurrentAttributesList_Command(Object source, CommandEventArgs e) |
| { // the rad grid function when a command for save, delete, or refresh |
| int getWebP_Id = GetValidWebpId(SearchBox.Text), listIndex; |
| WebServiceProxy wsp = new WebServiceProxy(); |
| switch (e.CommandName) |
| { |
| case "SaveChanges": //when the command is save, the attribute will be saved to the database |
| AttributeService.Attribute atts = new AttributeService.Attribute(); |
| CategoryStatus attributeStatus, status; |
| currentAttributes = new ArrayList(); |
| DataSet CurrentAttributeList = atts.GetAttributes(getWebP_Id); |
| // load the current categories into a list, stores the status of each cat id |
| foreach (DataRow dataRowAttribute in CurrentAttributeList.Tables[0].Rows) |
| { |
| attributeStatus.CatId = Convert.ToString(dataRowAttribute["AttributeId"]); |
| attributeStatus.Status = 0; |
| attributeStatus.Primary = false; |
| currentAttributes.Add(attributeStatus); |
| } |
| // cycles through the rad grid to detect changes |
| foreach (GridDataItem dataItem in CurrentAttributesList.Items) |
| { |
| string catid = dataItem["AttributeId"].Text; |
| listIndex = FindInList(catid, currentAttributes); |
| if (dataItem.ForeColor == System.Drawing.Color.Red) |
| { |
| updateListStatus(currentAttributes, ListStatus.Remove, listIndex); |
| } |
| if (listIndex < 0) //not in the list, needs to be added |
| { |
| status.CatId = catid; |
| status.Status = ListStatus.AddPrimary; |
| status.Primary = false; |
| currentAttributes.Add(status); |
| } |
| else |
| { |
| status = (CategoryStatus)currentAttributes[listIndex]; |
| } |
| } |
| // stores the status of each cat id (add, remove, or no change) |
| foreach (CategoryStatus cs in currentAttributes) |
| { |
| switch (cs.Status) |
| { |
| case ListStatus.NoChange: |
| break; |
| case ListStatus.AddPrimary: |
| wsp.AddProductAttribute(getWebP_Id, Convert.ToInt32(cs.CatId), Request.ServerVariables["auth_user"], 0); |
| break; |
| case ListStatus.Remove: |
| wsp.DeleteProductAttributes(getWebP_Id, Convert.ToInt32(cs.CatId)); |
| break; |
| } |
| } |
| CurrentAttributes(getWebP_Id); |
| case "DeleteSelected": |
| // using a for loop to loop through each item, then set the selected ones to be red and struck through |
| // need to call a rebind instead of binding to a table to keep font attributes |
| for (int i = 0; i < CurrentAttributesList.Items.Count; i++) |
| { |
| if (CurrentAttributesList.Items[i].Selected) |
| { |
| CurrentAttributesList.Items[i].Font.Strikeout = true; |
| CurrentAttributesList.Items[i].ForeColor = System.Drawing.Color.Red; |
| } |
| } |
| CurrentAttributesList.Rebind(); |
| break; |
| case "RebindGrid": // refresh grid back to original state, before any changes were made after hitting the save button |
| getWebP_Id = GetValidWebpId(SearchBox.Text); |
| CurrentAttributes(getWebP_Id); |
| foreach (string id in RadTreeNodeChanged) |
| { |
| ControlItem node = AttributeTree.FindChildByValue <ControlItem> (id); |
| node.ForeColor = System.Drawing.Color.Black; //doesn't work |
| } |
| break; |
| default: |
| break; |
| } |
| } |
| ASPX: |
| <asp:Content ID="CurrentAttributes" runat="server" ContentPlaceHolderID="AttributesRightContent"> |
| <asp:UpdatePanel ID="UpdatePanel1" runat="server"> |
| <contenttemplate> |
| <telerik:RadGrid ID="CurrentAttributesList" runat="server" Skin="Vista" AllowMultiRowSelection="true" Height="448px" AllowPaging="true" PageSize="20" AllowAutomaticDeletes="true"> |
| <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="AttributeID"> |
| <CommandItemTemplate> |
| <div style="padding: 5px 5px;"> |
| <asp:LinkButton ID="btnSaveSelected" runat="server" CommandName="SaveChanges" OnCommand="CurrentAttributesList_Command"><img style="border:0px;vertical-align:middle;" alt="" src="Images/save.png" /> Accept Changes</asp:LinkButton> |
| <asp:LinkButton ID="btnDeleteSelected" OnClientClick="javascript:return confirm('Delete selected attributes?')" runat="server" CommandName="DeleteSelected" OnCommand="CurrentAttributesList_Command"><img style="border:0px;vertical-align:middle;" alt="" src="Images/Cancel.gif" /> Delete selected customers</asp:LinkButton>   |
| <asp:LinkButton ID="btnRefreshGrid" runat="server" CommandName="RebindGrid" OnCommand="CurrentAttributesList_Command"><img style="border:0px;vertical-align:middle;" alt="" src="Images/refresh.png" /> Refresh attributes list to original</asp:LinkButton> |
| </div> |
| </CommandItemTemplate> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="true" EnableDragToSelectRows="true" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| </contenttemplate> |
| </asp:UpdatePanel> |
| </asp:Content> |
| <asp:Content ID="AttributesTree" runat="server" ContentPlaceHolderID="AttributesLeftContent"> |
| <asp:UpdatePanel id="AttributeUpdatePanel" runat="server" UpdateMode="Conditional"> |
| <contenttemplate> |
| <div class="DivAlignLeft"></div> |
| <div class="DivAlignRight"></div> |
| <telerik:RadTreeView ID="AttributeTree" runat="server" Skin="Vista" EnableDragAndDrop="true" |
| OnNodeDrop="AttributesTree_HandleDrop" OnClientNodeDropping="onNodeDropping" |
| OnClientNodeDragging="onNodeDragging" MultipleSelect="true"> |
| <WebServiceSettings Path="ProductsScreen.aspx" Method="LoadNodes" /> |
| </telerik:RadTreeView> |
| </contenttemplate> |
| </asp:UpdatePanel> |
| </asp:Content> |