| <telerik:RadGrid EnableViewState="true" EnableEmbeddedSkins="False" Skin="ABCustom" OnItemDataBound="RadGrid2_ItemCommand" |
| runat="server" ID="productrelations" OnNeedDataSource="datarelations" OnInsertCommand="RadGrid2_InsertCommand" |
| AutoGenerateColumns="false" AllowSorting="true" > |
| <MasterTableView NoMasterRecordsText="Er zijn momenteel geen vergelijkbare producten geselecteerd" |
| CommandItemDisplay="Top" DataKeyNames="ProductBaseId"> |
| <Columns> |
| <telerik:GridBoundColumn UniqueName="ProductBaseId" HeaderText="ProductBaseId" DataField="ProductBaseId" |
| SortExpression="ProductBaseId" Visible="false" ReadOnly="true" /> |
| <telerik:GridTemplateColumn UniqueName="RelatedProducts" AllowFiltering="false" HeaderText="Vergelijkbare producten" |
| SortExpression="RelatedProductBaseId"> |
| <ItemTemplate> |
| <%# Eval("RelatedProductBase.Name")%> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList runat="server" ID="relatedCategory" OnSelectedIndexChanged="fillproduct" |
| AutoPostBack="true" /> |
| <asp:DropDownList runat="server" ID="relatedProduct" /> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn AllowFiltering="false" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" HeaderText="Acties" UniqueName="Actions"> |
| <ItemTemplate> |
| <asp:ImageButton runat="server" ID="deleterelation" ImageUrl="~/Images/delete.png" |
| OnCommand="relation_OnClick" CommandArgument='<%# Eval("RelatedProductBaseId") %>' ToolTip="Delete" |
| OnClientClick="return confirm('Weet u zeker dat u de relatie met dit product wilt verwijderen?');" |
| CausesValidation="false" /> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| </Columns> |
| <EditFormSettings EditColumn-ButtonType="ImageButton" EditColumn-InsertImageUrl="~/Images/SaveBtn.gif" |
| EditColumn-UpdateImageUrl="~/Images/SaveBtn.gif" EditColumn-CancelImageUrl="~/Images/CancelBtn.gif"> |
| </EditFormSettings> |
| <CommandItemSettings AddNewRecordText="Vergelijkbare producten toevoegen" AddNewRecordImageUrl="~/Images/AddRecord.gif" |
| RefreshText="Verversen" RefreshImageUrl="~/Images/Refresh.gif" /> |
| </MasterTableView> |
| </telerik:RadGrid> |
| protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridItemEventArgs e) |
| { |
| if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode) |
| { |
| PrefetchPath prefetch = new PrefetchPath(EntityType.CategoryBaseEntity); |
| prefetch.Add(CategoryBaseEntity.PrefetchPathSubCategoryBase); |
| GridEditFormItem categorydopdown = (GridEditFormItem)e.Item; |
| DropDownList dropdownlistcategory = (DropDownList)categorydopdown.FindControl("relatedCategory"); |
| CategoryBaseCollection theCategoryColl = new CategoryBaseCollection(); |
| theCategoryColl.GetMulti(CategoryBaseFields.IsActive == true, prefetch); |
| dropdownlistcategory.Items.Add(new ListItem("- Selecteer een Category -", "0")); |
| foreach (CategoryBaseEntity category in theCategoryColl) |
| { |
| dropdownlistcategory.Items.Add(new ListItem(category.Name, category.Id.ToString())); |
| foreach (SubCategoryBaseEntity subCategory in category.SubCategoryBase) |
| { |
| dropdownlistcategory.Items.Add(new ListItem(".." + subCategory.Name, ".." + subCategory.Id.ToString())); |
| } |
| } |
| } |
| } |
| protected void RadGrid2_InsertCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditFormInsertItem insertitems = (GridEditFormInsertItem)e.Item; |
| ProductRelationBaseEntity newproduct = new ProductRelationBaseEntity(); |
| DropDownList deliverytime = (DropDownList)insertitems.FindControl("relatedProduct"); |
| newproduct.ProductBaseId = Url.QueryStringParser.GetInt("ProductId"); |
| newproduct.RelatedProductBaseId = int.Parse(deliverytime.SelectedValue); |
| newproduct.Save(); |
| productrelations.DataBind(); |
| } |
| protected void fillproduct(object sender, EventArgs e) |
| { |
| DropDownList dropdownlistcategory = (DropDownList)sender; |
| DropDownList dropdownlistprodudct = (DropDownList)dropdownlistcategory.Parent.FindControl("relatedProduct"); |
| ProductBaseCollection productcollection = new ProductBaseCollection(); |
| if (dropdownlistcategory.SelectedItem.Text.Substring(0, 2) == "..") |
| { |
| productcollection.GetMulti(ProductBaseFields.SubCategoryBaseId == int.Parse(dropdownlistcategory.SelectedValue.Substring(2, dropdownlistcategory.SelectedValue.Length - 2)) & ProductBaseFields.IsDeleted == false); |
| } |
| else |
| { |
| productcollection.GetMulti(ProductBaseFields.CategoryId == int.Parse(dropdownlistcategory.SelectedValue) & ProductBaseFields.IsDeleted == false); |
| } |
| dropdownlistprodudct.Items.Clear(); |
| dropdownlistprodudct.Items.Add(new ListItem("- Selecteer een product -", "0")); |
| foreach (ProductBaseEntity product in productcollection) |
| { |
| ProductRelationBaseEntity productrelation = new ProductRelationBaseEntity(Url.QueryStringParser.GetInt("ProductId"), product.Id); |
| if (productrelation.IsNew == true && Url.QueryStringParser.GetInt("ProductId") != product.Id) |
| dropdownlistprodudct.Items.Add(new ListItem(product.Name, product.Id.ToString())); |
| } |
| } |
| protected void datarelations(object source, GridNeedDataSourceEventArgs e) |
| { |
| ProductRelationBaseCollection product = new ProductRelationBaseCollection(); |
| product.GetMulti(ProductRelationBaseFields.ProductBaseId == Url.QueryStringParser.GetInt("ProductId")); |
| productrelations.DataSource = product; |
| } |
I place the RadFormDecorator1 see below.
I want no roundedcorners so EnableRoundedCorners="false"
But now the textboxes have no styling at all.
They look the same as if i have no styling at all.
What am i doing wrong?
| <form id="Form1" method="post" runat="server"> |
| <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" |
| DecoratedControls="All" Skin="Office2007" EnableRoundedCorners="false" |
| /> |
Hi,
I used the TextBoxTemplate which Nick provided.. in my code.. In my case, am creating the radcombo dynamically from code behind.. and adding the item template also dynamically from code behind. But its not displaying the values, Instead it creates text boxes with out any text.. And I want to set the the Initial value also like 'Select one'.. Its displaying "System.Data.DataRowView" in DropDown.. If I click it is displaying textboxes without text.. How can I solve this..
In designing we can give like <asp:TextBox id="text1" runat="server" Text='<%=Eval("Name") %>' />.. Like that how to do for text box in template of rad combo in code behind c#
| class TextBoxTemplate : ITemplate |
| { |
| string ColName = "Text"; |
| public void InstantiateIn(Control container) |
| { |
| TextBox textBox = new TextBox(); |
| textBox.ID = "tabTextBox"; |
| textBox.DataBinding += new EventHandler(this.txt_DataBind); |
| container.Controls.Add(textBox); |
| } |
| public void txt_DataBind(Object sender, EventArgs e) |
| { |
| TextBox txt = (TextBox)sender; |
| RadComboBoxItem radCombo = (RadComboBoxItem)txt.NamingContainer; |
| txt.Text = DataBinder.Eval(radCombo, ColName).ToString(); |
| } |
| } |
| /*-------------- Dynamic creation of rad combo----------------*/ |
| RadComboBox RadDropDownShopper = new RadComboBox(); |
| RadDropDownShopper.ID = "RadDropdownShopper" + i.ToString(); |
| RadDropDownShopper.Attributes.Add("style", "padding-top: 8px;"); |
| RadDropDownShopper.Attributes.Add("style", "padding-left: 30px;"); |
| RadDropDownShopper.ItemTemplate = new TextBoxTemplate(); |
| RadDropDownShopper.DataSource = FakeDataTable(); |
| RadDropDownShopper.DataBind(); |
| ("Select Shopper/Member")); |
| tdShopper.Controls.Add(RadDropDownShopper); |
Thanks in advance
Nimmi
| <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" |
| EnableAJAX="true"> |
| <telerik:RadGrid BorderWidth="0" ID="gridResult" runat="server" AutoGenerateColumns="False" |
| Width="100%" Height="480px" AllowSorting="True" AllowPaging="true" PageSize="25" |
| Skin="Hay" OnUpdateCommand="gridResult_UpdateCommand" OnDeleteCommand="gridResult_DeleteCommand" OnItemDataBound="gridResult_OnItemDataBound" |
| OnInsertCommand="gridResult_InsertCommand" OnNeedDataSource="gridResult_NeedDataSource" AllowFilteringByColumn="true"> |
| <MasterTableView EditMode="InPlace" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" |
| AllowNaturalSort="true" AllowMultiColumnSorting="true" Font-Names="Tahoma"> |
| <Columns> |
| <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn" HeaderStyle-Width="20px" |
| CancelText="İptal" EditText="Düzenle" InsertText="Kaydet" UpdateText="Güncelle"> |
| </telerik:GridEditCommandColumn> |
| <telerik:GridTemplateColumn DataField="NO" HeaderText="No" Visible="false" HeaderStyle-Width="20px" |
| SortExpression="NO"> |
| <ItemTemplate> |
| <asp:Label ID="lblNo" runat="server" Text='<%# Bind("NO") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="AD" HeaderText="Parametre Adı" SortExpression="AD" |
| HeaderStyle-Width="75px" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"> |
| <EditItemTemplate> |
| <telerik:RadTextBox ID="txtAd" runat="server" Text='<%# Bind("AD") %>' Width="75px" |
| SelectionOnFocus="CaretToEnd"> |
| </telerik:RadTextBox> |
| <asp:RequiredFieldValidator ID="rfvAd" runat="server" ControlToValidate="txtAd" Display="Dynamic" |
| ErrorMessage="Parametre adı girilmek zorundadır."></asp:RequiredFieldValidator> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblAd" runat="server" Text='<%# Bind("AD") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="ACIKLAMA" HeaderText="Açıklama" HeaderStyle-Width="100px" |
| SortExpression="ACIKLAMA" AllowFiltering="false"> |
| <EditItemTemplate> |
| <telerik:RadTextBox ID="txtAciklama" runat="server" Text='<%# Bind("ACIKLAMA") %>' |
| TextMode="MultiLine" Rows="4" Width="100px" SelectionOnFocus="CaretToEnd"> |
| </telerik:RadTextBox> |
| <asp:RequiredFieldValidator ID="rfvAciklama" runat="server" ControlToValidate="txtAciklama" |
| Display="Dynamic" ErrorMessage="Parametre açıklaması girilmek zorundadır."></asp:RequiredFieldValidator> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblAciklama" runat="server" Text='<%# Bind("ACIKLAMA") %>'> |
| </asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="GRUBU" HeaderText="Grubu" SortExpression="GRUBU" |
| HeaderStyle-Width="75px" ShowFilterIcon="false" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true"> |
| <EditItemTemplate> |
| <telerik:RadComboBox ID="ddlGrubu" runat="server" SelectedValue='<%# Bind("GRUBU") %>' |
| Width="75px"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" Text="Seçiniz" Value="-1" /> |
| <telerik:RadComboBoxItem runat="server" Text="A" Value="A" /> |
| <telerik:RadComboBoxItem runat="server" Text="B" Value="B" /> |
| <telerik:RadComboBoxItem runat="server" Text="C" Value="C" /> |
| <telerik:RadComboBoxItem runat="server" Text="D" Value="D" /> |
| <telerik:RadComboBoxItem runat="server" Text="DiÄŸer" Value="-"/> |
| </Items> |
| </telerik:RadComboBox> |
| <%--<dsi:MultipleListControl ID="ddlGrubu" runat="server"/>--%> |
| <%--<asp:RequiredFieldValidator ID="rfvGrubu" runat="server" ControlToValidate="ddlGrubu" |
| Display="Dynamic" ErrorMessage="Parametre grubu seçilmek zorundadır." InitialValue="Seçiniz"> |
| </asp:RequiredFieldValidator>--%> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblGrubu" runat="server" Text='<%# Bind("GRUBU") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="BIRIM" HeaderText="Birim" SortExpression="BIRIM" |
| HeaderStyle-Width="100px" AllowFiltering="false"> |
| <EditItemTemplate> |
| <telerik:RadTextBox ID="txtBirim" runat="server" Text='<%# Bind("BIRIM") %>' Width="100px" |
| SelectionOnFocus="CaretToEnd"> |
| </telerik:RadTextBox> |
| <asp:RequiredFieldValidator ID="rfvBirim" runat="server" ControlToValidate="txtBirim" |
| Display="Dynamic" ErrorMessage="Parametre birimi girilmek zorundadır."></asp:RequiredFieldValidator> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblBirim" runat="server" Text='<%# Bind("BIRIM") %>'> |
| </asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="DUYARLILIK" HeaderText="Duyarlılık" SortExpression="DUYARLILIK" |
| HeaderStyle-Width="50px" AllowFiltering="false"> |
| <EditItemTemplate> |
| <telerik:RadNumericTextBox ID="txtDuyarlilik" runat="server" MinValue="0" MaxValue="4" |
| NumberFormat-DecimalDigits="0" ShowSpinButtons="true" Text='<%# Bind("DUYARLILIK") %>' |
| Width="50px" SelectionOnFocus="CaretToEnd"> |
| </telerik:RadNumericTextBox> |
| <asp:RequiredFieldValidator ID="rfvDuyarlilik" runat="server" ControlToValidate="txtDuyarlilik" |
| Display="Dynamic" ErrorMessage="Parametrenin duyarlılığı belirtilmek zorundadır."></asp:RequiredFieldValidator> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblDuyarlilik" runat="server" Text='<%# Bind("DUYARLILIK") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridTemplateColumn DataField="ANALIZMETHODU" HeaderText="Analiz Methodu" |
| SortExpression="ANALIZMETHODU" HeaderStyle-Width="125px" AllowFiltering="false"> |
| <EditItemTemplate> |
| <telerik:RadTextBox ID="txtAnalizMethodu" runat="server" Text='<%# Bind("ANALIZMETHODU") %>' |
| TextMode="MultiLine" Rows="4" Width="125px" SelectionOnFocus="CaretToEnd"> |
| </telerik:RadTextBox> |
| <asp:RequiredFieldValidator ID="rfvAnalizMethodu" runat="server" ControlToValidate="txtAnalizMethodu" |
| Display="Dynamic" ErrorMessage="Parametre analiz methodu belirtilmek zorundadır."></asp:RequiredFieldValidator> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="lblAnalizMethodu" runat="server" Text='<%# Bind("ANALIZMETHODU") %>'> |
| </asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridButtonColumn ButtonType="ImageButton" ConfirmText="Parametreyi silmek istediÄŸinize emin misiniz?" |
| ConfirmTitle="Silme" ConfirmDialogType="RadWindow" UniqueName="DeleteColumn" |
| CommandName="Delete" HeaderStyle-Width="20px"> |
| </telerik:GridButtonColumn> |
| </Columns> |
| <NoRecordsTemplate> |
| <div style="float: left; width: 100%; text-align: center;"> |
| <strong> |
| <asp:Label ID="lblNoData" runat="server" Text="Gösterilecek her hangi bir veri bulunmadı."></asp:Label> |
| </strong> |
| </div> |
| </NoRecordsTemplate> |
| </MasterTableView> |
| <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" FileName="ParametreKarti"> |
| <Pdf PageTitle="Parametre Karti" PaperSize="A4" Author="DSI" PageWidth="100%" PageLeftMargin="3%" PageRightMargin="3%"/> </ExportSettings> |
| </telerik:RadGrid> |
| </telerik:RadAjaxPanel> |
| protected void gridResult_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| //System.Diagnostics.Debug.Write(ex.Message);//("Parametre", "Event handled.", MessagePriority.NoPrior, MessageType.Trace, ""); |
| try |
| { |
| DTO dto = new DTO(); |
| bool resultFlag = ParametreBusiness.DeleteEntity(Convert.ToInt32((e.Item.FindControl("lblNo") as Label).Text)); |
| if (resultFlag) |
| { |
| //Response.Redirect("~/Pages/Parametre/"); |
| } |
| else |
| { |
| Session["ErrorPage.ErrorMessage"] = "Parametre sayfasında parametre silinmesi sırasında bir hata oluştu. "; |
| Session["ErrorPage.PreviousPage"] = Request.Url.PathAndQuery; |
| Response.Redirect("~/Pages/ErrorPage/?action=error"); |
| } |
| } |
| catch (Exception ex) |
| { |
| System.Diagnostics.Debug.Write(ex.Message);//("Parametre", ex); |
| } |
| } |
| protected void gridResult_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| //System.Diagnostics.Debug.Write(ex.Message);//("Parametre", "Event handled.", MessagePriority.NoPrior, MessageType.Trace, ""); |
| try |
| { |
| DTO dto = new DTO(); |
| dto[ParametreEntityFields.No] = Convert.ToInt32((e.Item.FindControl("lblNo") as Label).Text); |
| dto[ParametreEntityFields.Ad] = (e.Item.FindControl("txtAd") as RadTextBox).Text; |
| dto[ParametreEntityFields.Aciklama] = (e.Item.FindControl("txtAciklama") as RadTextBox).Text; |
| dto[ParametreEntityFields.AnalizMethodu] = (e.Item.FindControl("txtAnalizMethodu") as RadTextBox).Text; |
| dto[ParametreEntityFields.Birim] = (e.Item.FindControl("txtBirim") as RadTextBox).Text; |
| dto[ParametreEntityFields.Duyarlilik] = (e.Item.FindControl("txtDuyarlilik") as RadNumericTextBox).Text; |
| dto[ParametreEntityFields.Grubu] = (e.Item.FindControl("ddlGrubu") as RadComboBox).SelectedValue; |
| bool resultFlag = ParametreBusiness.UpdateEntity(dto); |
| if (resultFlag) |
| { |
| //Response.Redirect("~/Pages/Parametre/"); |
| } |
| else |
| { |
| Session["ErrorPage.ErrorMessage"] = "Parametre sayfasında parametre güncellemesi sırasında bir hata oluştu. "; |
| Session["ErrorPage.PreviousPage"] = Request.Url.PathAndQuery; |
| Response.Redirect("~/Pages/ErrorPage/?action=error"); |
| } |
| } |
| catch (Exception ex) |
| { |
| System.Diagnostics.Debug.Write(ex.Message);//("Parametre", ex); |
| } |
| } |
| protected void gridResult_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| gridResult.DataSource = ParametreBusiness.RetrieveCollection();//a list |
| } |
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
| <telerik:RadChart runat="server" ID="RadChart1" DefaultType="Pie" Skin="Office2007"> |
| <Series> |
| <telerik:ChartSeries Name="Total" DataLabelsColumn="Name" DataYColumn="Total" Type="Pie" Appearance-LegendDisplayMode="ItemLabels"> |
| <Appearance> |
| <FillStyle FillType="Solid" MainColor="69, 115, 167"> |
| </FillStyle> |
| <TextAppearance TextProperties-Color="Black"> |
| </TextAppearance> |
| <Border Color="69, 115, 167" /> |
| </Appearance> |
| </telerik:ChartSeries> |
| </Series> |
| <PlotArea> |
| <XAxis AutoScale="False" Step="1"> |
| <AxisLabel TextBlock-Text="#Y"></AxisLabel> |
| <Appearance Color="134, 134, 134"> |
| </Appearance> |
| </XAxis> |
| <Appearance Dimensions-Margins="10,10,10,10"> |
| <FillStyle FillType="Solid" MainColor="255, 255, 255"> |
| </FillStyle> |
| <Border Visible="false" /> |
| </Appearance> |
| </PlotArea> |
| <Appearance Border-Visible="false" FillStyle-MainColor="White" /> |
| <ChartTitle Visible="false" /> |
| <Legend Visible="true" /> |
| </telerik:RadChart> |