Hello Telerik,
I am having a grid which has few columns from database in addition to inline editcommand column("Edit") & a Grid button column("Details").
i am having following heirarchy for the grid position.
What I am trying to do is :
On Click of "Details" button in Grid i want to make "Pane_TxtContacts" visibility to false & "Pane_NotesSection" visibility to true. And On "Edit" Click i am having Inline Edit & nothing to be done in respect with visibility.
So to attain this i put this in ajax manager. Aspx code for that is as below:
All works fine for "Details" with this code. But when i Click on Edit it does not result correctly showing error "Sys.ArgumentException:Value must not be null for Controls & behaviors. Parameter Name:element".
And,
When i remove the following statements from ajaxmanager than "Edit" works well but details doesn't
<telerik:AjaxSetting AjaxControlID="Grid_contacts">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
I am stuck here. Dont know where i m doing wrong. Please provide some work around as early as possible.
I am Posting Aspx.cs Page also below.
Please reply as Early as possible. Its kinda urgent.
Thank You,
Chinmay Sharma.
I am having a grid which has few columns from database in addition to inline editcommand column("Edit") & a Grid button column("Details").
i am having following heirarchy for the grid position.
| <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> |
What I am trying to do is :
On Click of "Details" button in Grid i want to make "Pane_TxtContacts" visibility to false & "Pane_NotesSection" visibility to true. And On "Edit" Click i am having Inline Edit & nothing to be done in respect with visibility.
So to attain this i put this in ajax manager. Aspx code for that is as below:
| <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" /> |
All works fine for "Details" with this code. But when i Click on Edit it does not result correctly showing error "Sys.ArgumentException:Value must not be null for Controls & behaviors. Parameter Name:element".
And,
When i remove the following statements from ajaxmanager than "Edit" works well but details doesn't
<telerik:AjaxSetting AjaxControlID="Grid_contacts">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="Splitter_bottom" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
I am stuck here. Dont know where i m doing wrong. Please provide some work around as early as possible.
I am Posting Aspx.cs Page also below.
| # 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. |
| } |
| } |
Thank You,
Chinmay Sharma.