Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
245 views
Hi All,

I am using RadToolTip control and under that I have place a textbox control when a user click on a radtooltip I would like to set the focus on a textbox control. For some reason I am not able to that. Please look at the code below and advise me anything which might be useful for me.

I am getting the textNote ID but for some reason when I call the focus method it doesn't set the focus.


Thanks for your response in advance.





<script type="text/javascript">
 
       function SetFocusToTextBox(txt) {
 
           var txtNote = document.getElementById(txt);
           alert(txtNote);
           txtNote.focus();
       }
 
   </script>




<telerik:RadGrid ID="gvTopics" runat="server" Font-Names="Verdana" Font-Size="XX-Small"
            Skin="Office2007" EnableEmbeddedSkins="true" GridLines="Both" AllowSorting="true"
            AllowPaging="true" PageSize="10" Width="99%" CellPadding="2" AutoGenerateColumns="False">
            <MasterTableView CommandItemDisplay="Top">
                <CommandItemSettings ShowAddNewRecordButton="false" RefreshImageUrl="" />
                <Columns>
                    <telerik:GridTemplateColumn>
                        <ItemTemplate>
                            <asp:ImageButton ID="btnShowMessagesFromTopicList" ToolTip="Show messages" runat="server"
                                CommandArgument='<%# Container.DataItem("id")%>' Text="show msgs" OnClick="btnShowMessagesFromTopicList_Click" />
                             <asp:ImageButton ID="btnAddMessage" runat="server" ToolTip="Reply to agent"
                                Text="Reply" CommandArgument='<%# Container.DataItem("id")%>' OnClick="btnReply_Click" />
                             <asp:ImageButton ID="btnAddNote" runat="server" Text="Add Note" CommandArgument='<%# Container.DataItem("id")%>' />
                             <asp:ImageButton ID="btnCloseTopic" runat="server" Text="close" Visible="false"
                                CommandArgument='<%# Container.DataItem("id")%>' OnClick="btnCloseTopic_Click"
                                ToolTip="Close topic" />
                            <asp:HiddenField ID="hidID" Value='<%# Bind("ID") %>' runat="server" />
                            <asp:HiddenField ID="hidCreatedBy" Value='<%# Bind("CreatedBy") %>' runat="server" />
                            <asp:HiddenField ID="hidNewAgentMessage" Value='<%# Bind("NewAgentMessage") %>' runat="server" />
                            <telerik:RadToolTip ID="rttpNote" Width="210" Height="200" HideEvent="ManualClose"
                                TargetControlID="btnAddNote" RelativeTo="Element" Skin="Windows7" Position="TopRight"
                                ManualClose="true" ShowEvent="OnClick" runat="server">
                                <table width="100%">
                                    <tr>
                                        <td>
                                            Notes :
                                            <asp:TextBox ID="txtNote" TextMode="MultiLine" Width="200" Height="200" onblur runat="server"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Button ID="btnSaveNote" CommandArgument='<%# Container.DataItem("id")%>' Text="Save"
                                                OnClick="btnSaveNote_Click" runat="server" />
                                        </td>
                                    </tr>
                                </table>
                            </telerik:RadToolTip>
                        </ItemTemplate>
                        <ItemStyle Width="15%" />
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>



  Protected Sub gvTopics_OnItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles gvTopics.ItemDataBound


        If TypeOf (e.Item) Is GridDataItem Then         

            Dim txtNote As TextBox = e.Item.FindControl("txtNote")             
            btnAddNote.Attributes.Add("onClick", "javascript:SetFocusToTextBox('" & txtNote.ClientID & "')")        

    End Sub
Shinu
Top achievements
Rank 2
 answered on 15 Oct 2012
4 answers
251 views
Hello,

Thank you in advance for any and all assistance.

I have a gridbound column that is ignoring alignment settings.

<telerik:GridBoundColumn DataField="TOTAL_AMOUNT" Aggregate="Sum"
    ItemStyle-Font-Size="XX-Small" HeaderStyle-Font-Size="XX-Small" FooterStyle-Font-Size="XX-Small" ItemStyle-Wrap="false" FooterStyle-Wrap="false" HeaderStyle-Wrap="false"
    ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"
    DataFormatString="{0:$###,##0.00}" DataType="System.Double"
    HeaderText="RQMT AMOUNT" SortExpression="Number" UniqueName="AMOUNT"
    FilterControlAltText="Filter AMOUNT column">
    <ItemStyle HorizontalAlign="right" />
</telerik:GridBoundColumn>

When I remove the attribute DataFormatString="{0:$###,##0.00}", the column then aligns correctly to the right.  I've also tried taking the CSS style approach, with no results.  Is there some tip/trick that I'm missing?

Thanks again for any assistance!
Tsvetina
Telerik team
 answered on 15 Oct 2012
4 answers
141 views
Hi,
this is the first time i touch asp.net and telerik. 
I have been trying to figure something out for quite a while :

i have a table in a database: 
ID NAME  NICK
123  Mario        Mar
234  Maria        Mia
.
. and so on...

I am starting out with an empty radgrid containing a template column that has a radComboBox inside. that radComboBox is populated from SqlDataSource (the ID). I have two more columns, Name and Nickname that all i need them to display is the Name and Nickname according to that table in the database that is in a Dataview variable called data now. it does not matter if the Name and Nickname columns are read only textboxes or labels.... the RadGrid is editable in-line. 

how can i display the name and nickname when the user selects an ID from the RadComboBox  while in edit mode and save that line in the table ? 

Example: in edit mode if i select the ID 123 it will instantly display Mario and Mar in the corresponding columns. and when I click the Insert button it will be inserted in the table. and then finally if i click the submit button it will send the table to the database... but thats another issue.. 

THANK YOU HELPERS ! ( just take it easy on me.. I'm still very new and learning.. )
Shinu
Top achievements
Rank 2
 answered on 15 Oct 2012
0 answers
187 views
Hi All,


I have a RadGrid for which radMenu is bound as context menu
the grid displays the items such as PersonFirstname,PersonLastname,emailid
when i click on emailid the context menu with the options
Copy,paste,... gets displayed.


for example when i click on someone@somemail.com
it displays copy,paste,edit,...
when i click on copy i need the "someone@somemail.com" value either in javascript or server side event

My javascript function is below

 function OnClientItemClickedHandler(sender, eventArgs)
    {   
        var personid, txt, lsreturnval;
             
        txt = eventArgs.Item.Text
        lsreturnval = '0'
        personid = document.getElementById("<%=hdnPersonID.ClientID %>").value
        try
        {
            if (txt == 'View/Edit Contact')
                lsreturnval=window.showModalDialog('../Contact/Editcontact.aspx?person_id='+personid+'&Mode=EDIT','EditContact','dialogWidth:'+editWidth+'px;dialogHeight:'+editHeight+'px;status:no;help:no;resizable:no;scroll:yes;maximize:no');
            else if (txt == 'Add')
                lsreturnval=window.showModalDialog('../Contact/Editcontact.aspx?Person_id='+personid+'&Mode=ADD','','dialogWidth:'+editWidth+'px;dialogHeight:'+editHeight+'px;status:no;help:no;resizable:no;scroll:yes;maximize:no');
            else if (txt == 'Copy')
            {   
            /// the code must go here
            }     

                
            else if (txt == 'Delete')
                if(!confirm('Are you sure you wish to delete company contact Relationship ?'))
                {
                    <%=mnuCompanyContact.ClientID%>.OnClientItemClickedHandler=OnClientItemClickedHandler;
                    return false;
                }
                else
                    return true;
                
            if (lsreturnval!='1')
            {
                <%=mnuCompanyContact.ClientID%>.OnClientItemClickedHandler=OnClientItemClickedHandler;
                return false;
            }
            
        }
        catch (err)
        {
            <%=mnuCompanyContact.ClientID%>.OnClientItemClickedHandler=OnClientItemClickedHandler;
            return false;
        }
       
    }

serverside .vb code

Protected Sub mnuCompanyContact_ItemClick(ByVal sender As Object, ByVal e As Telerik.WebControls.RadMenuEventArgs) Handles mnuCompanyContact.ItemClick
        Try
            If e.Item.Text.ToString.ToUpper = "COPY" Then
                GetComPanyContact(hdnCompanyId.Value)
            ElseIf e.Item.Text.ToString.ToUpper = "VIEW/EDIT CONTACT" Then
                GetComPanyContact(hdnCompanyId.Value)
            ElseIf e.Item.Text.ToString.ToUpper = "ADD" Then
                GetComPanyContact(hdnCompanyId.Value)
            ElseIf e.Item.Text.ToString.ToUpper = "DELETE" Then
                DeleteCompanyContact(hdnContactID.Value)
            End If
        Catch ex As Exception
            'TODO: Error Handler
            CUtility.PageErrorHandler(Err.Number, ex, "Event mnuCompanyContact_ItemClick")
        End Try
    End Sub


the above event never gets fired.



the markup code(.aspx)

  <radG:RadGrid ID="grdCompanyContacts" runat="server" AutoGenerateColumns="False"
                        EnableAJAX="False" GridLines="None" Width="100%" Skin="eCrm" AllowSorting="true"
                        EnableAJAXLoadingTemplate="true" LoadingTemplateTransparency="20" BorderStyle="None"
                        BorderWidth="0px" CellPadding="0" CellSpacing="1"  HeaderStyle-BackColor="#818A8F">
                        <%--AllowPaging="True" PageSize="20"--%>
                        <ItemStyle BorderStyle="None" Height="20px" />
                        <AlternatingItemStyle BorderStyle="None" Height="20px" />
                        <HeaderStyle  CssClass="grid_head1" />
                        <ClientSettings EnableClientKeyValues="True">
                            <Selecting AllowRowSelect="True" />
                            <ClientEvents OnRowContextMenu="RCM2" OnRowSelected="RS2" />
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="250px" />
                        </ClientSettings>
                        <MasterTableView EditMode="InPlace" Width="100%" DataKeyNames="PERSON_ID">
                            <NoRecordsTemplate>
                            </NoRecordsTemplate>
                            <Columns>
                                <radG:GridBoundColumn DataField="PERSON_ID" Visible="False" UniqueName="colPersonID" />
                                <radG:GridBoundColumn DataField="ASSOCIATED_COMPANY_COUNT" Visible="False" UniqueName="colASSOCIATED_COMPANY_COUNT" />
                                <radG:GridTemplateColumn UniqueName="colControls">
                                    <HeaderStyle Width="4%" />
                                    <ItemTemplate>
                                        <asp:ImageButton runat="Server" ToolTip="Edit Contact" ID="imgEdit" OnClick="UpdateCompanyContactGrid"
                                            ImageUrl="../Images/edit.gif" />
                                        <asp:ImageButton runat="Server" ToolTip="Delete Contact" ID="imgDelete" ImageUrl="../Images/Delete_Rec.gif"
                                            OnClick="imgOnClick_DeleteCompanyContact" />
                                    </ItemTemplate>
                                </radG:GridTemplateColumn>
                                <radG:GridTemplateColumn HeaderText="Name" SortExpression="contact_name" UniqueName="contact_name">
                                    <HeaderStyle Width="20%" />
                                    <ItemTemplate>
                                        <a class="gray" href="../contact/Contact.aspx?Person_id=<%# DataBinder.Eval(Container.DataItem,"person_id") %>">
                                            <%#DataBinder.Eval(Container.DataItem, "CONTACT_NAME")%>
                                        </a>
                                    </ItemTemplate>
                                </radG:GridTemplateColumn>
                                <radG:GridBoundColumn DataField="TITLE" HeaderText="Title" SortExpression="TITLE"
                                    Resizable="False" UniqueName="column1">
                                    <HeaderStyle Width="20%" />
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                </radG:GridBoundColumn>
                                <radG:GridTemplateColumn HeaderText="Office" SortExpression="company_name" UniqueName="company_name">
                                    <HeaderStyle Width="20%" />
                                    <ItemTemplate>
                                        <a  class="gray" href="../company/Company.aspx?Company_Id=<%# DataBinder.Eval(Container.DataItem,"COMPANY_ID") %>&Office_Id=<%# DataBinder.Eval(Container.DataItem,"COMPANYID") %>">
                                            <%# DataBinder.Eval(Container.DataItem,"COMPANY_NAME") %>
                                        </a>
                                    </ItemTemplate>
                                </radG:GridTemplateColumn>
                                <radG:GridBoundColumn DataField="address" Visible="False" SortExpression="address"
                                    HeaderText="Address" Resizable="False" UniqueName="column1">
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                    <HeaderStyle Width="20%" />
                                </radG:GridBoundColumn>
                                <radG:GridBoundColumn DataField="city" SortExpression="city" Visible="False" HeaderText="City"
                                    Resizable="False" UniqueName="column1">
                                    <ItemStyle HorizontalAlign="Left" Wrap="False" />
                                    <HeaderStyle Width="20%" />
                                </radG:GridBoundColumn>
                                <radG:GridTemplateColumn HeaderText="Email" SortExpression="EMAIL" UniqueName="E-Mail">
                                    <HeaderStyle Width="15%" />
                                    <ItemTemplate>
                                        <%# DataBinder.Eval(Container.DataItem,"EMAIL_INVALID") %>
                                        <a class="gray" href="mailto:<%# DataBinder.Eval(Container.DataItem,"EMAIL") %>">
                                            <%# DataBinder.Eval(Container.DataItem,"EMAIL") %>
                                        </a>
                                    </ItemTemplate>
                                </radG:GridTemplateColumn>
                                <radG:GridTemplateColumn UniqueName="Tel" HeaderText="Tel">
                                    <HeaderStyle Width="25%" />
                                    <ItemTemplate>
                                        <%# DataBinder.Eval(Container.DataItem,"PHONE_NUMBER_INVALID") %>
                                        <%# DataBinder.Eval(Container.DataItem,"PHONE_NUMBER") %>
                                    </ItemTemplate>
                                </radG:GridTemplateColumn>
                            </Columns>
                            <ExpandCollapseColumn Visible="False" Resizable="False">
                                <HeaderStyle Width="20px" />
                            </ExpandCollapseColumn>
                            <RowIndicatorColumn Visible="False">
                                <HeaderStyle Width="20px" />
                            </RowIndicatorColumn>
                        </MasterTableView>
                        <ExportSettings>
                            <Pdf PageBottomMargin="" PageFooterMargin="" PageHeaderMargin="" PageHeight="11in"
                                PageLeftMargin="" PageRightMargin="" PageTopMargin="" PageWidth="8.5in" />
                        </ExportSettings>
                        <PagerStyle Visible="false" />
                    </radG:RadGrid>
                      <telerik:RadScriptManager ID="ScriptManager" runat="server" />
                    <radM:RadMenu ID="mnuCompanyContact" runat="server" IsContext="True" OnClientItemClicking="OnClientItemClickedHandler"
                        ContextMenuElementID="none" Skin="eRebalContextMenu" OnItemDataBound="mnuCompanyContact_ItemDataBound" OnItemClick="mnuCompanyContact_ItemClick" Height="73px" Width="119px">
                        <Items>
                            <radM:RadMenuItem ID="RadMenuItem10" runat="server" Text="Copy">
                            </radM:RadMenuItem>
                            <radM:RadMenuItem ID="RadMenuItem8" runat="server" Text="View/Edit Contact">
                            </radM:RadMenuItem>
                            <radM:RadMenuItem ID="RadMenuItem5" runat="server" Text="Add">
                            </radM:RadMenuItem>
                            <radM:RadMenuItem ID="RadMenuItem11" runat="server" Text="Delete">
                            </radM:RadMenuItem>
                        </Items>
                    </radM:RadMenu>


I have been struck for 4 to 5 days
please help me
any help would be greatly appreciated.


Regards,
Sudha
Ragha
Top achievements
Rank 1
 asked on 15 Oct 2012
3 answers
111 views
I use Panel bar for Personal Information and its look like:

Email: abc@com
Name: Abc
etc.

now at end I mention a edit button. How can I achieve this functionality when user click on edit button than another panel bar is coming and convert all my data(abc@com) into textboxes. I have attached two pictures which show my all scena

Thanks
Princy
Top achievements
Rank 2
 answered on 15 Oct 2012
8 answers
203 views
Hello,
I have a grid that is simply bound to a dataset and it is always in edit mode to give us somewhat of an excel like feel.  We have a need to add a column that is of a dropdown type.  On selected index change we need it to update the dataset accordingly.  

Questions are:
1.  How do i get a column to contain a dropdown and fill it with values?
2.  On change of dropdown index how do update the underlying dataset or will the grid handle that? 

Thanks.  

Below is my grid that we are currently using:

<telerik:RadGrid ID="rgridChemValues" runat="server"
                    CssClass="gridview-custom" Skin="Transparent" OnPreRender="rgridChemValues_PreRender"
                    AllowMultiRowEdit="True" EnableViewState="true"
                    oncolumncreated="rgridChemValues_ColumnCreated" ShowFooter="True"
                    EnableHeaderContextMenu="True">
                    <MasterTableView AutoGenerateColumns="true" EditMode="InPlace" CommandItemDisplay="TopAndBottom">
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    <HeaderStyle Width="100px" />
                        <CommandItemTemplate>
                        </CommandItemTemplate>
                        <CommandItemSettings ExportToPdfText="Export to PDF" />
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"
                            Visible="True">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"
                            Visible="True">
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridBoundColumn HeaderText="FieldApplicationKeyVS" Display="false" DataField="FieldApplicationKey"
                                UniqueName="FieldApplicationKeyVisible">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                    <ClientSettings>
                        <ClientEvents OnRowContextMenu="RowContextMenu"
                            OnColumnContextMenu="rgridChemValues_OnColumnContextMenu"></ClientEvents>
                        <Selecting AllowRowSelect="true" />
                    </ClientSettings>
                    <FilterMenu EnableImageSprites="False">
                    </FilterMenu>
                </telerik:RadGrid>

Shinu
Top achievements
Rank 2
 answered on 15 Oct 2012
1 answer
107 views
I have a grid that loads with all the fields editable but I need to resize the editable text boxes to make the grid fit on the page. Can someone post some code that will do this?

Thanks!
Jayesh Goyani
Top achievements
Rank 2
 answered on 14 Oct 2012
1 answer
78 views
Hi,

I have radgrid with GridEditCommandColumn.
I always keep grid items in edit mode.
In edit mode I also want to hide the Cancel image.

Please suggest.

Thanks,
Aditi

 

Jayesh Goyani
Top achievements
Rank 2
 answered on 14 Oct 2012
5 answers
190 views
I'm having huge problems with the rad combo box.  I'm sure it worked once, but its not working now, and I can't seem to get it working.

Basicly on post back selectedIndexChanged and TextChanged are never firing.  init and load and ItemCreated are always being fired on postback though.

Page:
%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
    EnableEventValidation="false" CodeFile="Default.aspx.vb" Inherits="_Default" 
    Title="Notice Board" %> 
.... 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="cph" runat="Server"
..... 
 
 <telerik:RadComboBox ID="rcbCategories" runat="server" Skin="WebBlue" AutoPostBack="true" 
                    AppendDataBoundItems="True" DataSourceID="sdsCategories" DataTextField="category" EnableLoadOnDemand="false"  
                    DataValueField="categoryID" > 
                    <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    <Items> 
                        <telerik:RadComboBoxItem Text=" All News " Value="0" /> 
                    </Items> 
                </telerik:RadComboBox> 
 
...... 
 
</asp:Content> 


Code:
 Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
 
        If Not Page.IsPostBack Then 
            logUser() 
        End If 
        If Not Page.IsPostBack Then 
            Me.lblPageTitle.Text = Page.Title 
        End If 
 
    End Sub 
 
 Protected Sub rcbCategories_Init(ByVal sender As ObjectByVal e As System.EventArgs) Handles rcbCategories.Init 
 End Sub 
 
    Protected Sub rcbCategories_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles rcbCategories.ItemCreated 
 
    End Sub 
 
    Protected Sub rcbCategories_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles rcbCategories.ItemDataBound 
 
    End Sub 
 
    Protected Sub rcbCategories_ItemsRequested(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles rcbCategories.ItemsRequested 
 
    End Sub 
 
    Protected Sub rcbCategories_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles rcbCategories.Load 
 
    End Sub 
 
    Protected Sub rcbCategories_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbCategories.SelectedIndexChanged 
        If lbArchive.Text = archiveText Then 
            'Me.lbArchive.Text = currentText 
            Me.sdsNews.SelectCommand = "uspSelectCurrentNews" 
            Me.sdsNews.DataBind() 
            Me.RadGrid1.DataBind() 
        Else 
            'Me.lbArchive.Text = archiveText 
            Me.sdsNews.SelectCommand = "uspSelectArchiveNews" 
            Me.sdsNews.DataBind() 
            Me.RadGrid1.DataBind() 
        End If 
    End Sub 


Thanks in advance for any help you can offer.

Regards

Waseem
Top achievements
Rank 1
 answered on 14 Oct 2012
2 answers
165 views
I tried to use these Javascript calls to close my Radwindow, but it does not work at all:

function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }

  function Close() {
        var oWindow = GetRadWindow();
        oWindow.argument = null;
        oWindow.close();
        return false;

    }

I have a very old version of the telerik controls, probably dated back 2006-2007.  I checked many tutorials online such as the links below, but none of the methods are working for me.

http://demos.telerik.com/aspnet-ajax/window/examples/clientsideevents/defaultcs.aspx
http://www.telerik.com/community/forums/aspnet-ajax/window/close-radwindow-programmatically.aspx

Any Suggestions....

Waseem
Top achievements
Rank 1
 answered on 14 Oct 2012
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?