Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
181 views
Is it possible to have a drop zone for an asyncUploader inside a Radgrid in edit mode?
Any demo or sample about this?
Thanks,
Felice
Felice
Top achievements
Rank 1
 answered on 07 Dec 2013
1 answer
71 views
Good night,
   I get the same error than in the telerik demo page:

              http://demos.telerik.com/aspnet-ajax/editor/examples/filemanagers/defaultcs.aspx

When I click on Image Manager icon, the dialog opens but its very small. It only happens with Chrome browser (my version is 31.0.1650.63 m)

I attach the screenshot.

Is there any solution?
Thank you in advance
Miguel

 
A. Koster
Top achievements
Rank 1
 answered on 07 Dec 2013
1 answer
133 views
Hello,

I'm trying to set the RadListBox DataKeyField within the code behind.  When I attempt to assign the value I get the error: 

[column_name] is neither a DataColumn nor a DataRelation for table DefaultView

The value returned from the string category variable exactly matches with the column name in the [Product] table.

Here is my applicable code:

aspx
<telerik:RadListBox ID="RadListBox2" runat="server"
       Height="200"
       Width="300"
       AllowReorder="true"
       SelectionMode="Multiple"
       AllowDelete="true"
       DataSourceID="SelectedAttributes">
</telerik:RadListBox>
 
<asp:SqlDataSource ID="SelectedAttributes" runat="server"
        ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
        SelectCommand="SELECT @catName FROM [Product] WHERE [Number] = @Number">
            <SelectParameters>
                <asp:Parameter Name="catName"  />
            </SelectParameters>
            <SelectParameters>
                <asp:ControlParameter Name="Number"
                  ControlID="tbSearch"
                  PropertyName="Text"/>
              </SelectParameters>
    </asp:SqlDataSource>



code-behind:
//Get CategoryName
SqlConnection conn1 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ToString());
SqlCommand commDetails = new SqlCommand("SELECT CategoryFieldName FROM [AttributeCategory] WHERE CategoryID = @CatID", conn1);
 
 conn1.Open();
 commDetails.Parameters.Add("@CatID", SqlDbType.Int);
commDetails.Parameters["@CatID"].Value = (RadListView1.SelectedItems[0] as RadListViewDataItem).GetDataKeyValue("CategoryID").ToString();
object catName = (object)commDetails.ExecuteScalar();
conn1.Close();
 
string category = catName.ToString();
 
SelectedAttributes.SelectParameters["catName"].DefaultValue = category;
 
//Pass Data Keys For RadListBox2
RadListBox2.DataKeyField = category;
RadListBox2.DataSortField = category;
RadListBox2.DataTextField = category;
Jessica
Top achievements
Rank 1
 answered on 06 Dec 2013
2 answers
103 views
Hi

I wonder if anyone can shed any light on what is going on here please.

I have a grid into which I programatically add a hyperlink depending upon the value of a column in each row, like so;

public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
  {
        if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Parent")
        {
                    string linkValue = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["NotesLink"].ToString();
                    HyperLink hl = new HyperLink();
                    string strFunctionToCall = "ViewCheck('" + linkValue + "')";
                    hl.Attributes.Add("onClick", "return " + strFunctionToCall + ";");
                    hl.ToolTip = "Click for more info....";
                    hl.Text = linkValue;
                    hl.Font.Underline = true;
                    hl.ForeColor = Color.Blue;
                    GridDataItem item = (GridDataItem)e.Item;
                    item["NotesLink"].Controls.Add(hl);
        }
}

This works fine and pops a Telerik Window with info via a javascript function.

Within each row, I can have a button which when clicked will expand the child row, like so;

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "ShowAbstractDetails" && e.Item.OwnerTableView.Name == "Parent")
{
                GridDataItem parentRow = e.Item as GridDataItem;
                parentRow.Selected = true// Force the row to be selected
                if (parentRow.HasChildItems)   // Ignore ChildRow clicks
                {
                    // Expand selected item
                    int temp = RadGrid1.SelectedItems.Count;
                    foreach (GridDataItem item in RadGrid1.SelectedItems)   
                    {
                        if (item.Selected)
                        { item.Expanded = true; }
                        else
                        { item.Expanded = false; }
                    }
                }
}

When the child row expands, all of the hyperlinks disappear?

I clearly need to trap again to re-apply the link, but where do I do this?

Any help appreciated

Roger
Roger
Top achievements
Rank 1
 answered on 06 Dec 2013
1 answer
195 views
Hi,

Could you show me how to change the insert/update/cancel "links" into buttons? I know it can be done in custom form but I have to work an EditForm.  I also need to change the text on the button from "insert" to "save".

Sorry, I typed the subject wrong, it shouldn't say "image button", I just need a regular button with text on it.

Thank you for your help!

Helen
Helen
Top achievements
Rank 1
 answered on 06 Dec 2013
1 answer
142 views
I can insert everythings here using Chrome Developer Tool.
Slav
Telerik team
 answered on 06 Dec 2013
1 answer
652 views
Hi Team,

I want to hide HTML option in the Tool bar of Radeditor. I saw your post -
http://www.telerik.com/community/forums/aspnet-ajax/editor/hiding-text-from-the-design-html-amp-preview-buttons-in-radeditor.aspx. This works smoothly.

Besides style, do you have any other way to avoid HTML option rendering on the page?

Thanks,
PK

Marin Bratanov
Telerik team
 answered on 06 Dec 2013
1 answer
76 views
I have a Telerik Ajax Panel with a dropdownlist, a textbox (both with autopostback = true) and then another two readonly textboxes inside it. All controls are telerik controls.

The editable textbox has a serverside event TextChanged. When a user enters text and then hits return the ajaxloadingpanel is triggered (I get the spinning graphic) and once the server side code has completed the readonly textboxes are populated. When a user enters text and then hits TAB the ajaxloadingpanel is not triggered (no graphic) but eventually the readonly textboxes are populated.

How can I get the ajaxloadingpanel to trigger in both situations ie when the RETURN key or the TAB key are used.
Mych
Top achievements
Rank 1
 answered on 06 Dec 2013
1 answer
296 views
Hi there,  I tried using the following example to create a simple grid with auto CRUD.  It looks good but when I click the "update" button the edited fields just reset and nothing else happens.

http://www.telerik.com/community/code-library/aspnet-ajax/grid/automatic-operations-with-sqldatasource-control.aspx

I've had to programmatically add the datasource as my app is rocking a legacy connection string encription routine.

Here's my ASP page:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Edit_GovernanceContacts.aspx.vb"
    Inherits="APSubmission.Edit_GovernanceContacts" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="uc1" TagName="Menu" Src="Menu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title>Submission System</title>
</head>
<body style="background-color: #f2ffff">
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <uc1:Menu ID="Menu1" runat="server"></uc1:Menu>
    </div>
    <div style="padding: 10px 0 0 10px">
        Edit Governance Contacts
        <telerik:RadGrid ID="gridContacts" runat="server" AllowAutomaticDeletes="True" EnableAJAX="True"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" Skin="WebBlue">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="recID" CommandItemDisplay="TopAndBottom">
                <EditFormSettings>
                    <EditColumn UniqueName="EditCommandColumn"></EditColumn>
                </EditFormSettings>
                <Columns>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="imagebutton" />
                    <telerik:GridBoundColumn DataField="recID"
                        FilterControlAltText="Filter columnID column" HeaderText="ID"
                        UniqueName="recID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="submissionSetID"
                        FilterControlAltText="Filter columnSubmissionSet column"
                        HeaderText="Submission Set ID" UniqueName="submissionSetID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="contactName"
                        FilterControlAltText="Filter columnContactName column"
                        HeaderText="Contact Name" UniqueName="contactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="addDate" DataType="System.DateTime"
                        FilterControlAltText="Filter columnAddDate column" HeaderText="Add Date"
                        ReadOnly="True" UniqueName="addDate">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="addWho"
                        FilterControlAltText="Filter columnAddWho column" HeaderText="Add Who"
                        ReadOnly="True" UniqueName="addWho">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn UniqueName="ButtonColumn" Text="Delete" CommandName="Delete"
                        ButtonType="LinkButton"/>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>


And the code behind to create the datasource:
Protected Sub gridContacts_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles gridContacts.NeedDataSource       
        Dim myDataSource As New SqlDataSource
 
        myDataSource.ConnectionString = _functions.GetConnectionString()
        myDataSource.DeleteCommand = "delete GovernanceContact where recID = @recID"
        myDataSource.InsertCommand = "insert GovernanceContact (submissionSetID, contactName, addDate, addWho) values @submissionSetID, @contactName, @addDate, @addWho)"
        myDataSource.SelectCommand = "select * from GovernanceContact where submissionSetID = @submissionSetID"
        myDataSource.UpdateCommand = "update GovernanceContact set contactName = @contactName where recID = @recID"
 
        myDataSource.DeleteParameters.Add("recID", DbType.Int32)
 
        myDataSource.InsertParameters.Add("submissionSetID", DbType.Int32, _editSubmissionSetID)
        myDataSource.InsertParameters.Add("contactName", DbType.String)
        myDataSource.InsertParameters.Add("addDate", DbType.DateTime)
        myDataSource.InsertParameters.Add("addWho", DbType.String)
 
        myDataSource.SelectParameters.Add("submissionSetID", DbType.Int32, _editSubmissionSetID)
 
        myDataSource.UpdateParameters.Add("contactName", DbType.String)
        myDataSource.UpdateParameters.Add("recID", DbType.Int32)
 
        gridContacts.DataSource = myDataSource
        gridContacts.MasterTableView.DataSource = myDataSource
    End Sub

I'm obviously doing something wrong, but I just don't know what it is.

Thanks for any help you can provide,
Kenyon.
Viktor Tachev
Telerik team
 answered on 06 Dec 2013
1 answer
120 views

Hi,

I have an implementation question which I'm hoping someone with much more experience and expertise could guide me in the right direction.

I need to load a batch of 5000 ~ 10,000 phone numbers into a database.

The user can select and upload a file using RadUpload and RadGrid with Paging turned on.

The user can preview, add, delete the record in the RadGrid and then click on 'Insert' button to load the phone numbers into database.

I'm really hoping to cache the data instead of using a saved file on the server for re-binding.

I think RadGrid only holds data for the current page, so what would be the best way to implement this?

Thank you in advance~

Helen


This is what I'm currently doing in code behind...newbie style!

protected void Page_Load(object sender, EventArgs e)
{
    this.tollFreeInventoryLogic = (TollFreeInventoryLogic)this.Session[SESSION_ATTR_NAME];
    if (tollFreeInventoryLogic == null)
    {
        this.tollFreeInventoryLogic = new TollFreeInventoryLogic();
        this.Session[SESSION_ATTR_NAME] = this.tollFreeInventoryLogic;
    }
}
protected void RadButtonUploadToGrid_Click(object sender, EventArgs e)
{
    string targetFolder = RadUpload1.AppRelativeTemplateSourceDirectory + RadUpload1.TargetFolder;
    string fileName = targetFolder + "/" + RadUpload1.UploadedFiles[0].GetName();
    Session["fileName"] = fileName;
 
    GetDataFromMemory();
}
 
protected void GetDataFromFile()
{
    if (Session["fileName"] != null)
    {
        string fileName = (string)Session["fileName"];
        try
        {
            using (StreamReader sr = new StreamReader(Server.MapPath(fileName)))
            {
 
                string tollFreeList = sr.ReadToEnd();
                string[] tollFreeArray = tollFreeList.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None);
 
                DataTable dt = CreateDataTable(tollFreeArray);
                RadGrid1.DataSource = dt;
            }
             
        }
        catch (Exception err)
        {
            Console.WriteLine("The file could not be read:");
            Console.WriteLine(err.Message);
        }
    }
}
 
protected void GetDataFromMemory()
{
    foreach (UploadedFile file in RadUpload1.UploadedFiles)
    {
 
        byte[] bytes = new byte[file.ContentLength];
        file.InputStream.Read(bytes, 0, bytes.Length);
        string tollFreeList = System.Text.Encoding.Default.GetString(bytes);
        string[] tollFreeArray = tollFreeList.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None);
 
        DataTable dt = CreateDataTable(tollFreeArray);
 
        RadGrid1.DataSource = dt;
        RadGrid1.DataBind();
 
    }
     
}
 
private DataTable CreateDataTable(string[] tollFreeArray)
{
    DataTable dt = new DataTable();
    DataRow dr;
    dt.Columns.Add("TollFreeNumber");
    foreach (string line in tollFreeArray)
    {
        //Debug.WriteLine(line);
        if (line.Trim().Length > 0)
        {
            dr = dt.NewRow();
            dr["TollFreeNumber"] = line;
            dt.Rows.Add(dr);
        }
    }
    return dt;
}
 
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    GetDataFromFile();
}
Viktor Tachev
Telerik team
 answered on 06 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?