Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
121 views
Hi All,

I am using RadControls for ASP.NET Q3 2010. I have a radgrid which has filtering enabled. When toggling the filter button on for the first time, the text "select" is temporarily displayed where the filter control should be. The text is displayed for a moment then the filter controls are rendered correctly. See attachment. I am not sure what would cause this behavior.

How do I prevent "select" from being displayed at all when the filter controls are being rendered?

Regards,
Cliff
Radoslav
Telerik team
 answered on 25 Mar 2011
1 answer
82 views
Hi, 
I have used RadDockZone to perform drag and drop. The Drag and Drop works fine. But the problem is i couldn't save or maintain the order in which the final drag and drop leaves.
i.e if initially, the order is as 

Item A - dock[0]
Item B - dock[1]
Item C - dock[2]
Item D - dock[3]
After several drag and drop, the order is changed as
Item C - dock[2]
Item D - dock[3]
Item B - dock[1]
Item A - dock[0]

I couldn't save the position that 'Item C' is now in 1st position, 'Item D' in 2nd position...etc of the order.
Is there any way to save the actual position i.e the order ?


Pero
Telerik team
 answered on 25 Mar 2011
2 answers
370 views
Hi,

I have radgrid and "inPlace" edit mode. whenever i want to edit save and cancel display left side automatically. but i want to display right side in these two button. Please let me know how do we display in right side.

I have attached image also. please check and give me a tips for this one,

Thanks in Advance,
Dhamu.
Dhamodharan
Top achievements
Rank 1
 answered on 25 Mar 2011
2 answers
162 views
Good afternoon,

I am working on an application that sends a message with one ore more file attached to it. I'm using a AsyncUpload control to accomplish the upload of the files while user can still be writting the message.

The problem is that, when deploying it, the following happens:
1. User chooses a file to upload: it begins uploading (progress bar starts moving and left icon remains orange)
2. After finishing upload, suddenly an exception is thrown. Exception can be one of these:
a) The proccess cannot access the file XXXXXX.doc because it is in use by other process: this only happens with small (200kb or less) files. Temporal file does not appear in the Temporary Filder.
b) Remote server said: NotFound: this happens with big files (9 MB more or less in our tests). In this case, we already find the file in the Temporary Folder. The fact is that the file there is ok. After changing its extension to ZIP (which was the file's extension), it works fine, so the file is correctly upload, but it stills throws an exception.

I've tried changing the security settings of the temporary folders, giving permissions to users, but nothing changes.

The curious thing is that this only happens in deplyment. Control works fine in local machine.

Do you have any idea about what I've done wrong?
Equipo Desarrollo
Top achievements
Rank 1
 answered on 25 Mar 2011
10 answers
195 views
All My RadGrid event SelectedIndexChanged don't work after 2010.2.826! Anybody can help me?
gezim
Top achievements
Rank 1
 answered on 25 Mar 2011
3 answers
186 views
Hi,

I was trying to RadListBox LoadOnDemand feature. I was creating the RadListBox and setting EnableLoadOnDemand property dynamically/programatically. I gave it a DataSource and called DataBind on it. But, It loads all the data in it instead of doing the LoadOnDemand. Am i missing something?

Thanks in advance!!!
Helen
Telerik team
 answered on 25 Mar 2011
1 answer
143 views

I have a series of stored procedures created to handle the Select, Insert, Update and Delete needs of the system. Many of the columns are dynamically driven.  The delete functionality works perfectly but Update is throwing me some odd issues and I'm not certain where I've made my mistakes. Any direction would be helpful.

The Problem:
When you click Edit the form comes up correctly (See awardgrid-edit.jpg) with even the ItemID on the top indicating I have the appropriate record correlating to the database ID.  However when you click the Update button the AJAX does a post back and the Edit field is empty and the button for the [Update] now has no text (See awardgrid-afterupdate.jpg).

The ASPX Page Snippet

<telerik:radscriptmanager ID="RadScriptManager1" Runat="server">
</telerik:radscriptmanager>
<uc1:Awards ID="Awards1" runat="server" />

Awards User Control Snippet (ASCX)
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rgProfileItem">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rgProfileItem" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Windows7" EnableSkinTransparency="true" runat="server" />
  
<telerik:RadGrid ID="rgProfileItem" runat="server" 
    AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" 
    GridLines="None" Skin="Windows7"
    OnItemDataBound="rgProfileItem_ItemDataBound" OnInsertCommand="rgProfileItem_InsertCommand"
    OnDeleteCommand="rgProfileItem_DeleteCommand" OnUpdateCommand="rgProfileItem_UpdateCommand" 
    onneeddatasource="rgProfileItem_NeedDataSource" AllowAutomaticUpdates="false" AllowAutomaticInserts="false">
  
<MasterTableView AutoGenerateColumns="False" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
 DataKeyNames="ItemID" EditMode="EditForms">
  
    <Columns>
        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="Edit">
            <HeaderStyle Width="20px" />
        </telerik:GridEditCommandColumn>
        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
            ImageUrl="~/images/delete-16x16.png" Text="Delete" UniqueName="Delete">
            <HeaderStyle Width="20px" />
        </telerik:GridButtonColumn>
        <telerik:GridBoundColumn DataField="Title" 
            FilterControlAltText="Filter Title column" HeaderText="Title" 
            SortExpression="Title" UniqueName="Title">
            <HeaderStyle Width="30%" />
        </telerik:GridBoundColumn>
        <telerik:GridDateTimeColumn DataField="DateReceived" 
            FilterControlAltText="Filter DateReceived column" HeaderText="Date Received" 
            SortExpression="DateReceived" UniqueName="DateReceived" 
            DataType="System.DateTime">
            <HeaderStyle Width="150px" />
        </telerik:GridDateTimeColumn>
        <telerik:GridTemplateColumn DataField="Notes" 
            FilterControlAltText="Filter Notes column" Groupable="False" HeaderText="Notes" 
            UniqueName="Notes">
            <ItemTemplate>
                <asp:Label ID="shortNote" runat="server" Text='<%# Eval("Notes") %>' />
                <asp:Label ID="longNote" runat="server" Visible="false" Text='<%# Eval("Notes") %>' />
                <telerik:RadToolTip ID="RadToolTip1" runat="server" 
                    Skin="Windows7" RelativeTo="Element" Width="400px" CssClass="infotooltip" Position="TopCenter" TargetControlID="shortNote">
                    <%# Eval("Notes") %>
                </telerik:RadToolTip>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
<EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit Item: {0}"
    CaptionDataField="ItemID" EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Width="600px">
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
    <FormTemplate>
        <asp:Table ID="pubForm" CssClass="pubForm" CellSpacing="0" CellPadding="2" runat="server">
            <asp:TableFooterRow>
                <asp:TableCell ColumnSpan="2">
                    <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                    </asp:Button> 
                    <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                    </asp:Button>
                </asp:TableCell>
            </asp:TableFooterRow>
        </asp:Table> 
    </FormTemplate>
  
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False"></FilterMenu>
  
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
  
</telerik:RadGrid>

Awards User Control Code Behind (ASCX.CS)
int maxFieldLength = 100;
    int itemTypeID = 2; //ID item for Awards/Honors
    SqlConnection cn = new SqlConnection(CONNSTRINGINFO);
    protected void Page_Load(object sender, EventArgs e)
    {
    }
  
    protected void rgProfileItem_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        SqlDataAdapter adapter = new SqlDataAdapter();
        adapter.SelectCommand = new SqlCommand("sp_getProfileItem", cn);
        adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
        adapter.SelectCommand.Parameters.AddWithValue("@ProfileItemTypeId", itemTypeID);
        if (!string.IsNullOrEmpty(Request.QueryString["uid"]))
        {
            adapter.SelectCommand.Parameters.AddWithValue("@PersonID", Request.QueryString["uid"]);
        }
        DataTable myDataTable = new DataTable();
        cn.Open();
        try
        {
            adapter.Fill(myDataTable);
        }
        finally
        {
            cn.Close();
        }
        rgProfileItem.DataSource = myDataTable;
    }
    protected void rgProfileItem_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Label target = (Label)e.Item.FindControl("shortNote");
            if (!Object.Equals(target, null))
            {
                if (target.Text.Length > maxFieldLength)
                {
                    target.Text = target.Text.Substring(0, maxFieldLength) + " ...";
                }
            }
        }
        if (e.Item is GridEditFormItem && (e.Item as GridEditableItem).IsInEditMode)
        {
            GridEditableItem editedItem = (GridEditableItem)e.Item;
            string ItemID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ItemID"].ToString();
            Table editFormTable = (Table)editedItem.FindControl("pubForm");
            LoadProfileFields(int.Parse(ItemID), editFormTable);
        }
  
    }
  
    protected void rgProfileItem_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        //Delete Function
        cn.Open();
        GridDataItem item = (GridDataItem)e.Item;
        try
        {
            SqlCommand comm = new SqlCommand("sp_deleteProfileItem", cn);
            comm.CommandType = CommandType.StoredProcedure;
            comm.Parameters.AddWithValue("@ItemID", item.GetDataKeyValue("ItemID"));
            comm.ExecuteNonQuery();
            comm.Dispose();
        }
        catch (Exception ex)
        {
            lblErrMsg.Text = "<br />" + ex.Message;
        }
        finally
        {
            //lblErrMsg.Text = "Deleted " + item.GetDataKeyValue("ItemID");;
            cn.Close();
        }
    }
  
    protected void rgProfileItem_UpdateCommand(object sender, GridCommandEventArgs e)
    {
  
        DataTable dtProfileInfo = new DataTable();
        //Get the GridEditableItem of the RadGrid
        GridEditableItem editedItem = e.Item as GridEditableItem;
        string ItemID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ItemID"].ToString();
  
        cn.Open();
        try
        {
            string profInfo = ""; //A placeholder for the dynamic fields Profile Information uses
            string strProcName = "sp_updateProfileItem";
  
            //Get the DataTable of all Publication Fields
            dtProfileInfo = getProfileInfoFields();
            foreach (DataRow dr in dtProfileInfo.Rows)
            {
                //It is important to note that the stored procedure is expecting all rows to be seperated by a | and fields seperated by a =.
                //These symbols were used because they are not 'common place' and should not throw erroneous data.
                profInfo += dr["FieldID"] + "=" + getDynamicField(stripText(dr["FieldName"].ToString())) + "|";
            }
            if (profInfo.Length > 0)
            {
                profInfo = profInfo.Substring(0, profInfo.Length - 1); //Remove the last | symbol
            }
  
            SqlCommand comm = new SqlCommand(strProcName, cn);
            comm.CommandType = CommandType.StoredProcedure;
            comm.Parameters.AddWithValue("@ItemType", itemTypeID);  //Item Type ID
            comm.Parameters.AddWithValue("@ItemInfo", profInfo); //String of dynamic field values
            comm.Parameters.AddWithValue("@ProfileItem", ItemID);    //ItemID
            comm.ExecuteNonQuery();
            rgProfileItem.Rebind();
            editedItem.Edit = false;
        }
        catch (Exception ex)
        {
            rgProfileItem.Controls.Add(new LiteralControl("Unable to update Item. Reason: " + ex.Message));
            e.Canceled = true;
        }
        finally
        {
            cn.Close();
        }
  
    }
  
    protected void rgProfileItem_InsertCommand(object source, GridCommandEventArgs e)
    {
    }
  
    private void LoadProfileFields(int ItemID,Table formTable)
    {
        //Based on the Profile Item Type, determine and add what fields are neccessary.
        SqlCommand comm = new SqlCommand("sp_getProfileItemFieldsByType", cn);
        comm.CommandType = CommandType.StoredProcedure;
        comm.Parameters.AddWithValue("@ItemTypeID", itemTypeID);
        string tmpFieldValue = "";
        int rowInsertAt = formTable.Rows.Count - 1;
  
        if (ItemID != null && ItemID > 0)
        {
            comm.Parameters.Add("@ItemID", ItemID);
        }
        SqlDataAdapter fieldTypeAdapter = new SqlDataAdapter(comm);
  
        DataTable fieldTypeDataTable = new DataTable();
        fieldTypeAdapter.Fill(fieldTypeDataTable);
  
        foreach (DataRow fieldTypeDataRow in fieldTypeDataTable.Rows)
        {
            tmpFieldValue = "";
            try
            {
                bool isRequired = false;
                if (fieldTypeDataRow["Required"].ToString().Trim().ToLower() == "true")
                {
                    isRequired = true;
                }
                tmpFieldValue = fieldTypeDataRow["FieldValue"].ToString();
                rowInsertAt = formTable.Rows.Count - 1;
  
                switch (fieldTypeDataRow["FieldType"].ToString())
                {
                    case "Date":
                        formTable.Rows.AddAt(rowInsertAt,AddRow_Datebox(fieldTypeDataRow["FieldName"].ToString(), tmpFieldValue, isRequired));
                        break;
                    case "Textarea":
                        formTable.Rows.AddAt(rowInsertAt, AddRow_Textarea(fieldTypeDataRow["FieldName"].ToString(), tmpFieldValue, isRequired));
                        break;
                    default:
                        //By Default everything is a single-line text box.
                        formTable.Rows.AddAt(rowInsertAt,AddRow_Textbox(fieldTypeDataRow["FieldName"].ToString(), tmpFieldValue, isRequired));
                        break;
                }
            }
            catch
            {
                lblErrMsg.Text += "Field Broke!!<br>";
            }
        }
  
    }
  
    private DataTable getProfileInfoFields()
    {
        SqlCommand comm = new SqlCommand("sp_getProfileItemFieldsByType", cn);
        comm.CommandType = CommandType.StoredProcedure;
  
        if (itemTypeID > 0)
        {
            comm.Parameters.Add("@ItemTypeID", itemTypeID);
        }
        else
        {
            return null;
        }
        SqlDataAdapter adapter = new SqlDataAdapter(comm);
  
        DataTable dataTable = new DataTable();
        adapter.Fill(dataTable);
        return dataTable;
    }
  
    private TableRow AddRow_Textbox(string rowField, string defaultValue, bool isRequired)
    {
        TableRow tr = new TableRow();
        TableCell tcLabel = new TableCell();
        TableCell tcField = new TableCell();
  
        tcLabel.CssClass = "label";
        tcLabel.Text = rowField;
  
        RadTextBox rtb = new RadTextBox();
        rtb.Skin = "Windows7";
        rtb.Width = 230;
        rtb.ID = stripText(rowField);
        rtb.Text = defaultValue.Trim();
        tcField.Controls.Add(rtb);
        if (isRequired)
        {
            RequiredFieldValidator rfv = new RequiredFieldValidator();
            rfv.ControlToValidate = rtb.ID;
            rfv.ErrorMessage = "You must fill out this field";
            rfv.CssClass = "validator";
            rfv.ValidationGroup = "PublicationFields";
            tcField.Controls.Add(rfv);
            tcLabel.Text += "<span class=\"required-field\">*</span>";
        }
  
        tr.Cells.Add(tcLabel);
        tr.Cells.Add(tcField);
  
        //int rowInsertAt = pubForm.Rows.Count - 1;
        //pubForm.Rows.AddAt(rowInsertAt, tr);
        return tr;
    }
  
    private TableRow AddRow_Datebox(string rowField, string defaultValue, bool isRequired)
    {
        TableRow tr = new TableRow();
        TableCell tcLabel = new TableCell();
        TableCell tcField = new TableCell();
        DateTime dr;
  
        tcLabel.CssClass = "label";
        tcLabel.Text = rowField;
  
        RadDateInput rdi = new RadDateInput();
        rdi.DateFormat = "d";
        rdi.Skin = "Windows7";
        rdi.Width = 230;
        rdi.ID = stripText(rowField);
        if (DateTime.TryParse(defaultValue, out dr))
        {
            rdi.SelectedDate = dr;
        }
        tcField.Controls.Add(rdi);
        if (isRequired)
        {
            RequiredFieldValidator rfv = new RequiredFieldValidator();
            rfv.ControlToValidate = rdi.ID;
            rfv.ErrorMessage = "You must fill out this field";
            rfv.Display = ValidatorDisplay.Dynamic;
            rfv.CssClass = "validator";
            rfv.ValidationGroup = "PublicationFields";
            tcField.Controls.Add(rfv);
            tcLabel.Text += "<span class=\"required-field\">*</span>";
        }
  
        tr.Cells.Add(tcLabel);
        tr.Cells.Add(tcField);
  
        //int rowInsertAt = pubForm.Rows.Count - 1;
        //pubForm.Rows.AddAt(rowInsertAt, tr);
        return tr;
    }
  
    private TableRow AddRow_Textarea(string rowField, string defaultValue, bool isRequired)
    {
        TableRow tr = new TableRow();
        TableCell tcLabel = new TableCell();
        TableCell tcField = new TableCell();
  
        tcLabel.CssClass = "label";
        tcLabel.Text = rowField;
  
        RadEditor rtb = new RadEditor();
  
        rtb.Skin = "Windows7";
        rtb.ToolbarMode = EditorToolbarMode.ShowOnFocus;
        rtb.SkinID = "DefaultSetOfTools";
        rtb.ToolsFile = "~/App_Data/ToolsFile.xml";
        rtb.Width = 500;
        rtb.Height = 200;
          
        string[] imagePath = {"~/Editor/Img/UserDir/Marketing,~/Editor/Img/UserDir/PublicRelations"};
        rtb.ImageManager.ViewPaths = imagePath;
        rtb.ImageManager.UploadPaths = imagePath;
        rtb.ID = stripText(rowField);
        rtb.Content = defaultValue;
        tcField.CssClass = "field_onTop";
        tcField.Controls.Add(rtb);
        if (isRequired)
        {
            RequiredFieldValidator rfv = new RequiredFieldValidator();
            rfv.ControlToValidate = rtb.ID;
            rfv.ErrorMessage = "You must fill out this field";
            rfv.CssClass = "validator";
            rfv.ValidationGroup = "ProfileFields";
            tcField.Controls.Add(rfv);
            tcLabel.Text += "<span class=\"required-field\">*</span>";
        }
  
        tr.Cells.Add(tcLabel);
        tr.Cells.Add(tcField);
  
        //int rowInsertAt = pubForm.Rows.Count - 1;
        //pubForm.Rows.AddAt(rowInsertAt, tr);
        return tr;
    }
  
    private string stripText(string toStrip)
    {
        string pattern = "[^\\w\\.@-]";
        Regex rgx = new Regex(pattern);
        return rgx.Replace(toStrip, "");
    }
  
    private Control FindControlRecursive(Control root, string id)
    {
        if (root.ID == id)
        {
            return root;
        }
  
        foreach (Control c in root.Controls)
        {
            Control t = FindControlRecursive(c, id);
            if (t != null)
            {
                return t;
            }
        }
  
        return null;
    }
    private string getDynamicField(string controlID)
    {
        string fieldValue = "";
        Control fieldControl = FindControlRecursive(Page, controlID);
        if (fieldControl != null)
        {
            string tmpTypeBox = fieldControl.GetType().Name;
            switch (tmpTypeBox)
            {
                case "RadTextBox":
                    RadTextBox tmpTextControl = (RadTextBox)fieldControl;
                    fieldValue = tmpTextControl.Text;
                    break;
                case "RadDateInput":
                    RadDateInput tmpDateControl = (RadDateInput)fieldControl;
                    if (tmpDateControl.SelectedDate.HasValue)
                    {
                        fieldValue = tmpDateControl.DbSelectedDate.ToString().Split(' ')[0];
                    }
                    else
                    {
                        fieldValue = "";
                    }
                    break;
            }
        }
        else
        {
            lblErrMsg.Text = "Could not find the control ID for " + controlID;
        }
  
        return fieldValue;
    }
Pavlina
Telerik team
 answered on 25 Mar 2011
3 answers
197 views
Hi All

I am currently using the method below to poulate a combobox on the page load event:

Dim dataAdapter as new SetTableAdapter.someidentityTableAdapter
Dim adapterTable as DataTable
  
adapterTable = dataAdapter.getData()
  
Radcombo1.DataValueField = "Value1"
Radcombo1.DataTextField = "Value2"
Radcombo1.DataSource = adapterTable
Radcombo1.DataBind()

I would like to add a custom attribute to this combo box,
I am able to achive this in a load on demand senario but not the senario above!
Would someone be kind enough to point me in the right direction on how to achive this please?

Also when using custom attributes in this way is it still only possible to get the attributes value client side?

Many Thanks

Regards

Darren
Kate
Telerik team
 answered on 25 Mar 2011
1 answer
113 views
Hi,

Previously, I've Q3 2010 installed on my machine. Everything worked well.
Now I am about to install Q1 2011 but failed with the following error message:

There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor.

I am attaching 2 files:
- error screen shot
- log file screen shot

Here's my environment:
- Windows 7 x64
- VS 2010 with .NET 4

Please advise.
Biliana Ficheva
Telerik team
 answered on 25 Mar 2011
1 answer
194 views
I have a FileExplorer on a page with a very short logout period.

The problem is, when people are logged out, they are still able to click around the FileExplorers folders so long as they have visited the folders recently (the internal caching of the FileExplorer doesn't make another trip to the server).

Is it possible to have the FileExplorer not cache it's lists of flies, and ask the server when a folder is selected for the current list of files in that folder?
Dobromir
Telerik team
 answered on 25 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?