Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
120 views
I have a grid with this line
<EditFormSettings UserControlName="editform.ascx" EditFormType="WebUserControl">

</EditFormSettings>
I hit the edit button and it displays like it should but I can't get to the data when I hit update. below are the ascx and ascx.cs files and the update function

 

protected void RadGridCabFolders_UpdateCommand(object source, GridCommandEventArgs e)
{
    //GridEditManager editMan = (e.Item as GridEditableItem).EditManager;
    GridEditableItem editedItem = e.Item as GridEditableItem;
    UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
    string commandText = "UPDATE " + Page_Cab.CabRealName + " SET ";
    List<SqlParameter> paras = new List<SqlParameter>();
    int doc_id = (int)((GridEditableItem)e.Item).GetDataKeyValue(DOC_ID);
    varRadGridCabFoldersIndex = Convert.ToInt16(doc_id);
    foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns)
    {
        if (column is IGridEditableColumn && column.UniqueName != LOC && column.UniqueName != DELETED)
        {
            IGridEditableColumn editableCol = (column as IGridEditableColumn);
            if (editableCol.IsEditable)
            {
                //IGridColumnEditor editor = editMan.GetColumnEditor(editableCol);
 
                if (column.UniqueName != DOC_ID && column.UniqueName.ToLower() != TIME_STAMP)
                {
                    commandText += " " + column.UniqueName + "=@" + column.UniqueName + ",";
                    Control editFormControl = ((userControl)).FindControl(column.UniqueName);
                    Type editformType = editFormControl.GetType();
                    object editorValue =
                        (editformType.Name == "TextBox") ? ((TextBox)editFormControl).Text :
                        (editformType.Name == "DropDownList") ? ((DropDownList)editFormControl).Text :
                        (editformType.Name == "RadMaskedTextBox") ? ((RadMaskedTextBox)editFormControl).Text :
                        (editformType.Name == "RadDatePicker") ? ((RadDatePicker)editFormControl).ToString() : (object)null;
                     
                    paras.Add(new SqlParameter(column.UniqueName, editorValue));
                }
            }
        }
    }
    commandText = commandText.Substring(0, commandText.Length - 1) + " where doc_id=" + doc_id;
    DbHelper.ExecuteDbNonQuery(Page_Dept.DeptRealName, commandText, paras.ToArrayNullIsEmpty());
    setDT();
    ViewState["GridData"] = folder_dt;
 
    if (ViewState["GridData"] != null)
    {
        RadGridCabFolders.DataSource = ViewState["GridData"];
    }
}

 

using System;
using System.Data;
using System.Collections;
using System.Web.UI;
using Telerik.Web.UI;
using System.Data;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Text.RegularExpressions;
using TreenoCsLib;
 
 
    public partial class editform : System.Web.UI.UserControl
    {
 
        private object _dataItem = null;
        public CabItem Page_Cab { get { return (CabItem)Session[SessionKeys.SelCab]; } set { Session[TreenoCsLib.SessionKeys.SelCab] = value; } }
        public DeptItem Page_Dept { get { return (DeptItem)Session[SessionKeys.SelDept]; } set { Session[SessionKeys.SelDept] = value; } }
 
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (DataItem != null)
            {
                string ConnString = (string)Session[TreenoCsLib.SessionKeys.SelDeptDbConnString];
                SqlConnection conn = new SqlConnection(ConnString);
                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = new SqlCommand("select departmentid from departments where real_name='" + Page_Cab.CabRealName + "'", conn);
                conn.Open();
                SqlDataReader myReader = null;
                myReader = adapter.SelectCommand.ExecuteReader();
                myReader.Read();
                string departmentid = myReader["departmentid"].ToString();
                conn.Close();
                Control EditTable = FindControl("Table4");
                object[] editFormVals = ((System.Data.DataRowView)(DataItem)).Row.ItemArray;
                int i = 0;
                foreach (DataColumn colObj in ((DataRowView)(DataItem)).Row.Table.Columns)
                {
                    TableRow r = new TableRow();
                    string colName = colObj.ColumnName;
                    if (colName == "file_id" ||
                      colName == "document_id" ||
                      colName == "cabinet_id" ||
                      colName == "doc_id" ||
                      colName == "location" ||
                      colName == "deleted" ||
                      colName == "timestamp" ||
                      colName == "TimeStamp" ||
                      colName == "fsearch_id")
                    {
                    }
                    else
                    {
                        //need to look up required and regex
                        string ConnStringDoc = ConfigurationManager.ConnectionStrings["docutron"].ConnectionString;
                        SqlConnection connDoc = new SqlConnection(ConnStringDoc);
                        SqlDataAdapter adapterDoc = new SqlDataAdapter();
                        SqlDataReader myReaderDoc = null;
                        adapter.SelectCommand = new SqlCommand("SELECT required,regex FROM field_format where cabinet_id=" + departmentid + " and field_name='" + colName + "'", conn);
                        conn.Open();
                        myReader = adapter.SelectCommand.ExecuteReader();
                        string requiredField = "0";
                        string regExField = "";
                        if (myReader.HasRows)
                        {
                            myReader.Read();
                            requiredField = myReader["required"].ToString();
                            regExField = myReader["regex"].ToString();
                        }
                        conn.Close();
                        //need to look up dropdown list (
                        adapterDoc.SelectCommand = new SqlCommand("SELECT value FROM settings where k='dt," + Page_Dept.DeptRealName + "," + departmentid + "," + colName + "'", connDoc);
                        connDoc.Open();
                        myReaderDoc = adapterDoc.SelectCommand.ExecuteReader();
                        if (myReaderDoc.HasRows) //need dropdown
                        {
                            myReaderDoc.Read();
                            string pattern = ",,,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))";
                            Regex rg = new Regex(pattern);
                            string[] dropdownlistArr = rg.Split(myReaderDoc["value"].ToString());
                            TableCell c = new TableCell();
                            DropDownList tb = new DropDownList();
 
                            ArrayList tocs = new ArrayList(dropdownlistArr);
                            tb.DataSource = tocs;
                            tb.DataBind();
 
 
 
                            if (editFormVals[i].ToString() == null)
                            {
                                tb.SelectedIndex = 0;
                            }
                            else
                            {
                                tb.SelectedIndex = tocs.IndexOf(editFormVals[i].ToString());
                            }
                            tb.DataSource = null;
 
 
                            tb.ID = colName;
                            //tb.Text = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                        else if (colName.Contains("date"))
                        {
                            TableCell c = new TableCell();
                            RadDatePicker tb = new RadDatePicker();
                            tb.ID = colName;
                            tb.DbSelectedDate = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                        else
                        {
                            TableCell c = new TableCell();
                            TextBox tb = new TextBox();
                            tb.ID = colName;
                            tb.Text = editFormVals[i].ToString();
                            c.Controls.Add(new LiteralControl(colName + ": "));
                            c.Controls.Add(tb);
                            r.Cells.Add(c);
                            ((Table)EditTable).Rows.Add(r);
                        }
                    }
                    ++i;
                }
            }
             //((System.Data.DataRowView)(DataItem)).Row.ItemArray
            //((System.Data.DataColumn)((new System.Collections.ArrayList.ArrayListDebugView(((System.Data.InternalDataCollectionBase)(((System.Data.DataRowView)(DataItem)).Row.Table.Columns)).List)).Items[0])).ColumnName
            // Put user code to initialize the page here
        }
 
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
         
        /// <summary>
        ///        Required method for Designer support - do not modify
        ///        the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.DataBinding += new System.EventHandler(this.EmployeeDetails_DataBinding);
 
        }
        #endregion
 
        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }
 
        protected void EmployeeDetails_DataBinding(object sender, System.EventArgs e)
        {
            //ArrayList tocs = new ArrayList(new string[] { "Dr.", "Mr.", "Mrs.", "Ms." });
            //Control temp = FindControl("vendor");
            //((DropDownList)temp).DataSource = tocs;
            //((DropDownList)temp).DataBind();
 
            //object tocValue = DataBinder.Eval(DataItem, "vendor");
 
            //if (tocValue == DBNull.Value)
            //{
            //    tocValue = "Mrs.";
            //}
            //((DropDownList)temp).SelectedIndex = tocs.IndexOf((string)tocValue);
            //((DropDownList)temp).DataSource = null;
        }
 
    }

 

<%@ Control Language="c#" Inherits="editform" CodeFile="editform.ascx.cs" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:table id="Table2" cellspacing="2" cellpadding="1" width="100%" style="border-collapse: collapse" runat="server">
    <asp:TableRow CssClass="EditFormHeader">
        <asp:TableCell ColumnSpan="2">
            <b>Edit Form</b>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell ColumnSpan="2">
            <b>Test:</b>
        </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow>
        <asp:TableCell>
            <asp:Table id="Table4" runat="server">
            </asp:Table>
        </asp:TableCell>
    </asp:TableRow>
     <asp:TableRow>
        <asp:TableCell HorizontalAlign="Right" ColumnSpan="2">
            <asp:Button ID="btnUpdate" Text="Update" runat="server" CommandName="Update" Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>'>
            </asp:Button>
            <asp:Button ID="btnInsert" Text="Insert" runat="server" CommandName="PerformInsert" Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>'>
            </asp:Button>
              
            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
            </asp:Button>
        </asp:TableCell>
    </asp:TableRow>
</asp:table>

Andrey
Telerik team
 answered on 06 Dec 2011
1 answer
219 views
Hi,
I have a grid which is not using external pager. And I created custom pager event for index changing or chenged. So I'm manually sending data to grid datasource. But When I click to pager buttons, Pager is hiding.
How can I handle it. Or How can I manage it?

Thanks
Gökhan

Shinu
Top achievements
Rank 2
 answered on 06 Dec 2011
1 answer
167 views

Hi there,
    In my radchart, for y axis I set autoScale=False and added few items with different values. But the values are getting overlapped in the y -axis while doing this. Is there any way to over come this issue ? 
        I am attaching the desgin code and screen of the chart below for your reference

<telerik:RadChart ID="RadChart2" Height="400px" SkinsOverrideStyles="true" runat="server"
                AutoLayout="false">
                <ClientSettings />
                <PlotArea >
                    <XAxis>
                    </XAxis>
                    <YAxis AutoScale="false" >
                        <Items>
                            <telerik:ChartAxisItem Value="1">
                            </telerik:ChartAxisItem>
                            <telerik:ChartAxisItem Value="3">
                            </telerik:ChartAxisItem>
                            <telerik:ChartAxisItem Value="200">
                            </telerik:ChartAxisItem>
                        </Items>
                    </YAxis>
                </PlotArea>
                <Series>
                    <telerik:ChartSeries Name="Series 1" Type="Line">
                        <Appearance>
                            <LineSeriesAppearance Width="3" />
                            <PointMark Visible="True" Border-Width="10" Border-Visible="true" FillStyle-FillType="Solid"
                                Dimensions-AutoSize="true" Dimensions-Height="10px" Dimensions-Width="10px">
                            </PointMark>
                        </Appearance>
                        <Items>
                            <telerik:ChartSeriesItem XValue="1" YValue="1" Name="Item 20">
                            </telerik:ChartSeriesItem>
                            <telerik:ChartSeriesItem XValue="3" YValue="2" Name="Item 100">
                            </telerik:ChartSeriesItem>
                            <telerik:ChartSeriesItem XValue="4" YValue="70" Name="Item 100">
                            </telerik:ChartSeriesItem>
                            <telerik:ChartSeriesItem XValue="5" YValue="71" Name="Item 20">
                            </telerik:ChartSeriesItem>
                              <telerik:ChartSeriesItem XValue="6" YValue="73" Name="Item 20">
                            </telerik:ChartSeriesItem>
                          
                        </Items>
                    </telerik:ChartSeries>
                </Series>
            </telerik:RadChart>

Thanks and Regards
Shafi
Petar Marchev
Telerik team
 answered on 06 Dec 2011
1 answer
73 views
Hi,

We are using the radeditor Q3 2011.

We have a problem when the have a bullet list and pressing enter and backspace to get rid of the last bullet, we get an nbsp enclosed in <p> instead of a <br />:

<ul>
    <li>test</li>
    <li>analyse</li>
</ul>
<p>&nbsp;</p>

NewLineBr = True;
NewLineMode = Br;

Is there a fix for that coming, or is there a workaround ? Because we want to trim the last empty lines of a the text entered.

Thank you

Carl
Rumen
Telerik team
 answered on 06 Dec 2011
2 answers
103 views
Hello,

In HTML editor, there is an option to insert Form, Insert Drop down, Insert check box, Insert Radio button, etc.

For Inserted Form, it shows different properties in bottom area, but I haven't found such properties for other controls like "Drop down", "Radio button", "button", etc..

Is such feature supported in Telerik 's HTML Editor?

We want to allow our users to add Dropdowns, Radiobuttons, etc and they can directly add the options through properties.

Please let us know, if such thing is possible with Telerik 's HTML Editor?

Thanks in Advance,
Ashish Shukla
ashish
Top achievements
Rank 1
 answered on 06 Dec 2011
3 answers
154 views
Hello

I am using RadGrid with HierarchyLoadMode="Client" and have
 <telerik:RadGrid>

 <MasterTableView Name="ListGrid" AutoGenerateColumns="false" AllowMultiColumnSorting="false"
                        AllowAutomaticDeletes="false" CommandItemDisplay="Top" HierarchyLoadMode="Client"
                        NoDetailRecordsText="No Lists to display" ClientDataKeyNames="ListID" Width="100%">
                        <DetailTables>
<telerik:GridTableView Name="ListChildGrid" Width="100%" runat="server" EnableNoRecordsTemplate="true"
                              HierarchyLoadMode="Client  AllowSorting="true" AllowPaging="true" DataKeyNames="ListID" ClientDataKeyNames="ListID" AutoGenerateColumns="false" PageSize="5" CommandItemDisplay="Top">
...
...
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
 </telerik:RadGrid>

the Width of the Inner grid shows one column less than the parent grid

have attached a image of so and by the way i am using telerik version 2011.2.920.40

please suggest me an solution for so on client side.
Chetan
Top achievements
Rank 1
 answered on 06 Dec 2011
1 answer
62 views
Hi,

I noticed you're regularly updating the VSExtensions in the VS gallery. I don't get notified about these though.
Can you help me with that?

Cheers,
Blaize
Erjan Gavalji
Telerik team
 answered on 06 Dec 2011
2 answers
2.2K+ views
Hi All,

New to these controls so please forgive my igmnorance - I have come from an Infragistics background.  I wanted to create a simple page with 3 large buttons which when clicked would take you to the appropriate web page.  Easy I thought!
I declare my button as :-

<telerik:RadButton ID="btnTeamData" runat="server" Text="Team Data" Height="70px" Width="250px" Font-Size="18px" Icon-PrimaryIconUrl="~/Images/indycar_48.png"
Icon-PrimaryIconWidth="48" Icon-PrimaryIconHeight="48" AutoPostBack="False" Icon-PrimaryIconTop="10"
OnClientClicked="btnTeamView_OnClientClicked"
ToolTip="combined data recovered from the Teams">
</telerik:RadButton>

...and I have a javascript function at the top of the page
<script type="text/javascript" language="javascript"> 

function btnTeamView_OnClientClicked()
{
alert('Team View');
document.location.href = './teamview.aspx';
}

</script>

...what's odd is that as soon as the page loads I get the alert and the page tries to jump off to the specified new page.  I haven't clicked the button so why is it calling the OnClientClicked event?  How do I get this to work as I would expect?

Thanks

Slav
Telerik team
 answered on 06 Dec 2011
4 answers
106 views

This question concerns a few controls but any answer here will sort me out with the others.

Basically im tasked with developing an application that will enable registered users to create their own website which can then be maintained by themselves.

These sites will be created instantly once registration is complete. Or at least for now i think i have found how to update IIS with the directory and site settings.

My desire is for each user's site to have option of a set choice of pages, for example one being a scheduler page they can use to manage tasks/events etc.

So im wondering the best way to incorporate a scheduler into each users page (at registration) if they choose this option for their site, as well as how i would maintain that users entries/reminders/content etc so it is maintained when they return. is this already automatically stored somewhere? if so would it be tied to my main site or the users site (sub-domain) ?

im thinking along the lines of a website id record related to page records with this website id but not sure how i then associate controls within these pages for the relevant userid/websiteid/pageid...

this also applies to other controls such as editor as the user would maintain their site content on most pages with this.

thanks for any guidance.

Peter
Telerik team
 answered on 06 Dec 2011
2 answers
95 views
Hi,

I was going through following thread and found that renaming excel sheet is possible only with ExcelML.
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-set-excel-sheet-name-in-radgrid-export-to-excel-function.aspx

Since above post is a year long, so I was interested in asking whether this feature is already been added to export with HTML or not?

Thanks.
DIT
Top achievements
Rank 1
 answered on 06 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?