Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
122 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
213 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
165 views
I can insert everythings here using Chrome Developer Tool.
Slav
Telerik team
 answered on 06 Dec 2013
1 answer
692 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
95 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
327 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
138 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
1 answer
105 views
Is it possible to format the RadGrid results a certain way automatically?  It appears that the filtering items automatically choose which items are available based on the text in the column.  ie. If it is text, it adds the option "starts with" but if it is a number than it has other options so

What I would like is if it is determined to be a # account that it will properly format the results with commas. 

I had found where if I put it in the RadGrid_ColumnCreated, that I could do it there but I would have over 200 columns to possibly check.

Kurt Kluth
Top achievements
Rank 1
 answered on 06 Dec 2013
0 answers
108 views
Hi supporters,

I developed report by using reportviewer control in a portal.

Unfortunately, the reportviewer doesn't show correctly as described, it lost all icons in lost its functions also.

I attached herein the captured image of the control and the error which is shown when I inspecting the element in chrome browser.

Please help.
Tran
Top achievements
Rank 1
 asked on 06 Dec 2013
1 answer
173 views
function openRadWindow(url, title, width, height) {
    var oManager = GetRadWindowManager();
    oWnd = oManager.open(url, null);
    oWnd.set_title(title);
    oWnd.setSize(width, height);
    oWnd.center();
}

The function GetRadWindowManager returns NULL in IE 11 (and probably 10). Both, Chrome and Firefox working fine. The Function is executed manually by clicking a button, so I'm sure the page is completely loaded.

I'm working with Telerik 2013.2 SP1. Is this fixed in current releases?
Marin Bratanov
Telerik team
 answered on 06 Dec 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?