or
This is how my source page looks like
<telerik:RadGrid ID="radGridWrapper" runat="server" ShowHeader="false" BorderStyle="None" Width="100%" onexcelmlexportstylescreated="radGridWrapper_ExcelMLExportStylesCreated" onexcelmlexportrowcreated="radGridWrapper_ExcelMLExportRowCreated" > <MasterTableView Width="100%"> <ItemTemplate> <div id="id1" runat="server" style="width:800px;text-align:left; overflow:hidden;"> <telerik:RadGrid ID="RadGrid1" Width="100%" GridLines="Vertical" AllowPaging="true" PageSize="100" runat="server" AllowSorting="True" BackColor="white" Skin="Web20" onitemdatabound="RadGrid1_ItemDataBound" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Names="Arial" onexcelmlexportstylescreated="RadGrid1_ExcelMLExportStylesCreated" HeaderStyle-Wrap="true" onneeddatasource="RadGrid1_NeedDataSource" OnItemCreated="RadGrid1_ItemCreated" OnSortCommand="RadGrid1_SortCommand" OnInsertCommand="RadGrid1_InsertCommand" ongridexporting="RadGrid1_GridExporting" onpdfexporting="RadGrid1_PdfExporting" onpageindexchanged="RadGrid1_PageIndexChanged"> <PagerStyle Mode="NumericPages" /> <ClientSettings > <Scrolling UseStaticHeaders="true" AllowScroll="true"/> </ClientSettings> <ItemStyle Font-Names="Arial" HorizontalAlign="Left" BackColor="white"></ItemStyle> <AlternatingItemStyle Font-Names="Arial" HorizontalAlign="Left" BackColor="white"/> <MasterTableView Width="100%"> </MasterTableView> </telerik:RadGrid> </div> </td> <%-- </div>--%> <tr> <td style="height: 72px"> <telerik:RadGrid ID="RadGrid2" Width="100%" GridLines="Vertical" Visible="false" runat="server" AllowSorting="True" Skin="Web20" AllowPaging="true" PageSize="100" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="true" OnSortCommand="RadGrid2_SortCommand" HeaderStyle-Font-Names="Arial" onneeddatasource="RadGrid2_NeedDataSource" HeaderStyle-Wrap="true" onpageindexchanged="RadGrid2_PageIndexChanged"> <PagerStyle Mode="NumericPages" /> <ItemStyle Font-Names="Arial" HorizontalAlign="Left"></ItemStyle> <AlternatingItemStyle Font-Names="Arial" HorizontalAlign="Left" /> <MasterTableView Width="100%"> </MasterTableView> </telerik:RadGrid> <br /> </td> </tr> <%-- </div>--%> </ItemTemplate> </MasterTableView> </telerik:RadGrid>RadGrid radGrid = lbl_txt.Text == "All RadGrids" ? radGridWrapper : (RadGrid)radGridWrapper.Items[0].FindControl(lbl_txt.Text); //html.Visible = false; if (radGrid.Items.Count == 0) { Page.ClientScript.RegisterStartupScript(base.GetType(), "Alert", GC.Message("No records found")); return; } if (isExcelExport = true) { gridcaption = "<b style='color: blue; text-align: left;'>Effort Analysis Report </b>"; if (CheckBox4.Checked == true) { gridcaption += "<BR/>" + "<b>Process : </b>" + ddlprocess.SelectedItem.Text + " " + "|" + " " + "<b>Group : </b> " + ddlGroupby.SelectedItem.Text + " " + "|" + " " + "<b>From Date :</b>" + txtFromDate.Text + " " + "|" + " " + "<b>To Date :</b>" + txtToDate.Text; } radGrid.MasterTableView.Caption = gridcaption; radGrid.ExportSettings.FileName = "EffortAnalysis_" + "_from_" + txtFromDate.Text + "_to_" + txtToDate.Text; radGrid.ExportSettings.OpenInNewWindow = true; //radGrid.ExportSettings.IgnorePaging = true; //radGrid.ExportSettings.ExportOnlyData = true; gridBind(); radGrid.MasterTableView.ExportToExcel();Private Sub startNodeInEditMode(ByVal nodeValue As String) 'find the node by its Value and edit it when page loads Dim js As String = "Sys.Application.add_load(editNode); function editNode(){ " js += "var tree = $find(""" + ObjFoldersTree.ClientID + """);" js += "var node = tree.findNodeByValue('" + nodeValue + "');" js += "if (node) tree._startEdit(node); " js += "Sys.Application.remove_load(editNode);};" RadScriptManager.RegisterStartupScript(Page, Page.[GetType](), "nodeEdit", js, True) End Sub
Hi,
I am using RAD Grid and want to edit mode with some dropdown and textboxes.
I couldn’t able to push the values in to dropdown list . Since I am loading the data in code behind.
I am not using SqlDataSource in .aspx page. I am loading all the datas in code behind page.
Can you please help me on this issue?
Thanks in advance,
S. Murugesan
protected void rgManage_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { rgManage.DataSource = GetDataSet(); if (!Page.IsPostBack) { rgManage.MasterTableView.FilterExpression = "([Active] = True)"; GridColumn column = rgManage.MasterTableView.GetColumnSafe("Active"); column.CurrentFilterFunction = GridKnownFunction.EqualTo; column.CurrentFilterValue = "True"; } }<EditFormSettings EditFormType="Template"> <FormTemplate> <table id="Table1" cellspacing="1" cellpadding="1"> <tr> <td> <telerik:RadTabStrip runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" SelectedIndex="0" MultiPageID="RadMultiPage1"> <Tabs> <telerik:RadTab Text="Task Data" PageViewID="RadPageView1"> </telerik:RadTab> <telerik:RadTab Text="Notes" PageViewID="RadPageView2"> </telerik:RadTab> </Tabs> </telerik:RadTabStrip> <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0"> <telerik:RadPageView runat="server" ID="RadPageView1"> <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0"> <tr> <td> </td> <td> </td> </tr> <tr> <td> Clarify Account Nbr: </td> <td> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval( "Clarify Account Nbr" ) %>'> </asp:TextBox> </td> </tr> <tr> <td> Site ID: </td> <td> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval( "Site ID") %>' TabIndex="1"> </asp:TextBox> </td> </tr> <tr> <td> Quote ID: </td> <td> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Eval( "Quote ID") %>' TabIndex="2"> </asp:TextBox> </td> </tr> <tr> <td> EDP Created?: </td> <td> <asp:CheckBox ID="CheckBox1" runat="server" Text='<%# Eval( "EDP Created?") %>' TabIndex="3"> </asp:CheckBox> </td> </tr> <tr> <td align="right" colspan="2"> <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' runat="server" CommandName='Update'></asp:Button> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button> </td> </tr> </table> </telerik:RadPageView> <telerik:RadPageView runat="server" ID="RadPageView2"> <table id="Table2" cellspacing="1" cellpadding="1" width="250" border="0"> <tr> <td> <legend><b>Add Notes</b></legend> <table id="Tablenotes"> <tr> <td align="left"> Note Type : <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> </td> <td align="left"> </td> </tr> <tr> <td align="left" colspan="2"> Note Description </td> </tr> <tr> <td align="left"> <asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Rows="2" Width="650px"></asp:TextBox> </td> <td> <asp:ImageButton ID="ImageButton1" OnClick="btnAddNote_Click" runat="server" ToolTip="Add Note" ImageUrl="~/Images/add-icon.png" /> <asp:ImageButton Visible="false" ToolTip="Update" OnClick="imgbtnNotesUpdate_Click" ID="ImageButton4" runat="server" ImageUrl="~/Images/accept-icon.png" /> <asp:ImageButton Visible="false" ToolTip="Cancel" OnClick="imgbtnNotesCancel_Click" ID="ImageButton5" runat="server" ImageUrl="~/Images/delete-icon.png" /> </td> </tr> <tr> <td> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> <tr> <td> <div style="overflow: auto; height: 160px"> <asp:GridView ID="GridView1" BorderColor="#004000" runat="server" AutoGenerateColumns="false" BackColor="White" BorderWidth="1px" BorderStyle="Solid" CellSpacing="0" Width="100%" OnSelectedIndexChanged="gvNotes_SelectedIndexChanged" OnRowDataBound="gvNotes_RowDataBound"> <HeaderStyle Height="20px" BackColor="#004000" Font-Size="8pt" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" BorderColor="White" BorderWidth="0px" /> <PagerSettings Mode="NumericFirstLast"></PagerSettings> <RowStyle ForeColor="#000000" Font-Size="8pt" HorizontalAlign="Left" BorderWidth="1px" BorderColor="#004000" /> <AlternatingRowStyle Font-Size="8pt" ForeColor="#000000" BackColor="#F5F5E9" BorderWidth="1px" BorderColor="#004000" /> <PagerStyle HorizontalAlign="Right" Font-Bold="true" Font-Size="8pt" /> <Columns> <asp:TemplateField Visible="false"> <ItemTemplate> <asp:Label ID="lblonID" runat="server" Text='<%# Bind("onID") %>'></asp:Label> </ItemTemplate> <ItemStyle HorizontalAlign="Left" /> </asp:TemplateField> <asp:BoundField HeaderText="Note Description" DataField="Description" /> <asp:BoundField HeaderText="Note Type" DataField="Type" /> <asp:BoundField HeaderText="Created By" DataField="CreatedBy" /> <asp:BoundField DataFormatString="{0:MM/dd/yyyy}" HeaderText="Created Date" DataField="CreationDate" /> </Columns> </asp:GridView> </div> </td> </tr> </table> </telerik:RadPageView> </telerik:RadMultiPage> </td> </tr> </table> </FormTemplate> </EditFormSettings>protected void imgbtnNotesUpdate_Click(object sender, EventArgs e){ try { clsTaskUpdates_BL objBL = new clsTaskUpdates_BL(); //string strName = HttpContext.Current.User.Identity.Name.ToString(); //if (strName.Length > 0) // strName = strName.Substring(strName.IndexOf("\\") + 1); string strName = Session["UserName"].ToString(); gvNotes.DataSource = objBL.updateNotes_Bl(Session["selNoteID"].ToString(), Session["selorderID"].ToString(), strName, ddlNoteType.SelectedItem.Text, txtNoteDesc.Text.Trim(), DateTime.Now.ToString()); gvNotes.DataBind(); ddlNoteType.ClearSelection(); txtNoteDesc.Text = string.Empty; imgbtnNotesCancel.Visible = false; imgbtnNotesUpdate.Visible = false; btnAddNote.Visible = true; } catch (Exception ex) { }}protected void imgbtnNotesCancel_Click(object sender, EventArgs e){ ddlNoteType.ClearSelection(); txtNoteDesc.Text = string.Empty; imgbtnNotesCancel.Visible = false; imgbtnNotesUpdate.Visible = false; btnAddNote.Visible = true;}protected void gvNotes_SelectedIndexChanged(object sender, EventArgs e){ try { Label lblID = (Label)gvNotes.SelectedRow.Cells[0].FindControl("lblonID"); Session["selNoteID"] = lblID.Text; ddlNoteType.ClearSelection(); for (int index = 0; index < ddlNoteType.Items.Count; index++) { if (ddlNoteType.Items[index].Text.ToLower() == gvNotes.SelectedRow.Cells[2].Text.ToLower()) ddlNoteType.Items[index].Selected = true; } txtNoteDesc.Text = gvNotes.SelectedRow.Cells[1].Text.Trim().Replace(" ", ""); imgbtnNotesCancel.Visible = true; imgbtnNotesUpdate.Visible = true; btnAddNote.Visible = false; } catch (Exception ex) { }}