Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
326 views
Hello Sir,

Please provide me Help .

I want to call  function RowClick(sender, eventArgs) on Simple Link Buttton  not  to call <ClientEventsOnRowClick="RowClick" OnRowDblClick="RowDblClick"  OnGridCreated="GridCreated" OnCommand="GridCommand"   />


My code is details on   below.
  <script type="text/javascript">
        <!--
            var hasChanges, inputs, dropdowns, editedRow;

            function RowClick(sender, eventArgs) {

               
                 var a;
                var aa;
                var gridElement = sender.get_element();
                
                inputs = gridElement.getElementsByTagName("input");
                for (var i = 0; i < inputs.length; i++) {
                    var lowerType = inputs[i].type.toLowerCase();
                    if (lowerType == "text") {
                        a = inputs[i].id
                        aa = document.getElementById(a).value;
                    }

                }
                // alert("awanish");
                if (editedRow && hasChanges) {
                    alert('a');
                    hasChanges = false;
                    if (confirm("Update changes?")) {

                        PageMethods.fneditData(a, aa, editedRow, OnGetMessageSuccess, OnGetMessageFailure);
                        $find("<%= grdT101.MasterTableView.ClientID %>").updateItem(editedRow);
                    }
                }
            }
            function GetMessage() {

                PageMethods.Message(OnGetMessageSuccess, OnGetMessageFailure);

            }
            function OnGetMessageSuccess(result, userContext, methodName) {
                window.location = window.location;
                //////                
            }

            function OnGetMessageFailure(error, userContext, methodName) {

                alert(error.get_message());

            }
            function RowDblClick(sender, eventArgs) {
                editedRow = eventArgs.get_itemIndexHierarchical();
                $find("<%= grdT101.MasterTableView.ClientID %>").editItem(editedRow);
            }

            function GridCommand(sender, args) {
                if (args.get_commandName() != "Edit") {
                    editedRow = null;
                }
            }

            function GridCreated(sender, eventArgs) {
                var gridElement = sender.get_element();
                var elementsToUse = [];
                inputs = gridElement.getElementsByTagName("input");
                for (var i = 0; i < inputs.length; i++) {
                    var lowerType = inputs[i].type.toLowerCase();
                    if (lowerType == "hidden" || lowerType == "button") {
                        continue;
                    }

                    Array.add(elementsToUse, inputs[i]);
                    inputs[i].onchange = TrackChanges;
                }

                dropdowns = gridElement.getElementsByTagName("select");
                for (var i = 0; i < dropdowns.length; i++) {
                    dropdowns[i].onchange = TrackChanges;
                }

                //setTimeout(function() { if (elementsToUse[0]) elementsToUse[0].focus(); }, 100);
            }

            function TrackChanges(e) {
                hasChanges = true;
            }
     -->    
    </script>

<telerik:RadGrid runat="server" ID="grdT101"  Skin="Office2007"
            AutoGenerateColumns="false"   OnRowDrop="grdPendingOrders_RowDrop"
              AllowPaging="True"   AllowMultiRowSelection="true" BorderWidth="0"
            Width="100%"  PageSize="30" EnableHeaderContextMenu="true"  
            GridLines="Both"  onitemcommand="grdT101_ItemCommand" AllowAutomaticUpdates="True" >
                <%--<ItemStyle BackColor="#ffffff" />
                <HeaderStyle BackColor="#ffffff" />--%>                
                <MasterTableView DataKeyNames="T101_ID"  EditMode="InPlace" Width="100%"  >
                    <Columns>
                        <%--<telerik:GridBoundColumn HeaderText="ID"  ReadOnly="True" DataField="T201_ID" HeaderStyle-Width="3%"  />--%>
                        <telerik:GridTemplateColumn HeaderStyle-Width="3%" HeaderText="ID" HeaderStyle-Font-Bold="true" >

<ItemTemplate>

<%#Container.ItemIndex+1 %>

</ItemTemplate>

</telerik:GridTemplateColumn>

                        <telerik:GridBoundColumn  HeaderText="Act Exp(T101 - C101A)" DataField="C101A" HeaderStyle-Font-Bold="true" HeaderStyle-Width="94%"  ItemStyle-Width="94%" UniqueName="C101A" />
<telerik:GridTemplateColumn HeaderStyle-Width="3%">
<ItemTemplate>
<asp:LinkButton ID="cxc" runat="server" CommandArgument='<%#Eval("T101_ID") %>' CommandName="DeleteRow"  OnClientClick="if(!confirm('Are you sure to delete this record ?'))return false;" ><img src="../../images/delete.gif" /></asp:LinkButton>
  <asp:LinkButton ID="lnkbutton" runat="server" Text="LinkButton" CommandName="RowClick"></asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>

</Columns>
<CommandItemTemplate>
<asp:TextBox ID="txtC101A" runat="server"></asp:TextBox>
</CommandItemTemplate>
 </MasterTableView>
                <ClientSettings  AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <ClientEvents OnRowDropping="onRowDropping" OnRowClick="RowClick" OnRowDblClick="RowDblClick"
                    OnGridCreated="GridCreated" OnCommand="GridCommand"   />
                    <Scrolling  UseStaticHeaders="true"/>                   
                </ClientSettings>
                <PagerStyle Mode="NumericPages" PageButtonCount="4" />
            </telerik:RadGrid>


Please Provide help It is very-2 urgent

Your support will be highly appreciated.

Thank You,
Eyup
Telerik team
 answered on 27 Oct 2014
1 answer
72 views
Hi!
Is there a way to obtain the menu dynamic with the property "RenderMode = auto" on the window resize event and not only on the loading of the page?
Thank you!
Hristo Valyavicharski
Telerik team
 answered on 27 Oct 2014
1 answer
120 views
hi,

I have a project with a page that contains 2 radgrids.
in code behind I open a radwindow that does an update on a row in one grid, and changes the status, so that it appears in the other grid.

this is the code for opening the window


RadWindow ConfirmWindow = new RadWindow();
<
br>ConfirmWindow.NavigateUrl = "HolidayApproveDecline.aspx?Type=" + ((Byte)Type).ToString() + "&IDs=" + IDBuilder.ToString();<br>ConfirmWindow.Width = 450;
<
br>            ConfirmWindow.Height = 430;
<
br>            ConfirmWindow.ID = "wndUserAddHoliday";
<
br>            ConfirmWindow.VisibleOnPageLoad = true;
<
br>            ConfirmWindow.OnClientClose = "RefreshGrid";
<
br>            ConfirmWindow.VisibleStatusbar = false;
<
br>            ConfirmWindow.IconUrl = "../Images/address_book.png";
<
br>            ConfirmWindow.Title = "Bevestigen";
<br>            WindowBehaviors Behaviors = new WindowBehaviors();
<
br>            Behaviors |= WindowBehaviors.Close;
<
br>            ConfirmWindow.Behaviors = Behaviors;<br>
<
br>            ConfirmWindow.Modal = true;<br>            RadWindowManager MasterWindowManager = (RadWindowManager)this.Master.FindControl("MasterWindowManager");<br>            MasterWindowManager.Windows.Add(ConfirmWindow);


Now, upon returning he fires the clientside Refresh function which contains following code:

  <telerik:RadCodeBlock ID="Block2" runat="server">
        <script type="text/javascript">
            function RefreshGrid() {

                var grdGeneralOverview = $find("<%= grdGeneralOverview.ClientID %>").get_masterTableView();
                grdGeneralOverview.rebind();

                var grdApproveDecline = $find("<%= grdApproveDecline.ClientID %>").get_masterTableView();
                grdApproveDecline.rebind();
      </script>
    </telerik:RadCodeBlock>

The OnNeedDatasource functions for both grids in code behind are fired, and the datasources contain the updated data for both grids.

However, and this is the catch, on the screen only the second grid is updated (grdApproveDecline 
)
if I switch the 2 rebinds around, the other gets updated on screen.

Does anyone know why this happens?




Eyup
Telerik team
 answered on 27 Oct 2014
1 answer
169 views
I am wondering what the ID field in the Hyperlink Manager does exactly. I tried looking it up and saw that it might have to deal with tracking the number of clicks the hyperlink has had. If that's all the ID field does, is there a way to remove the field from the list there. I would prefer to not have to download the entire EditorDialogues and edit those if there is a way.

http://i.imgur.com/94anKwY.png link to a picture of the hyperlink manager with the ID field visible
Ianko
Telerik team
 answered on 27 Oct 2014
1 answer
86 views
Is there a demo for Drag and Drop Functionality in Master Details Grid. If not not can you provide one. Please

Thanks,
Siva
Konstantin Dikov
Telerik team
 answered on 27 Oct 2014
5 answers
269 views
I want to binding binaryimage from sql server.But it is not show. 

My Insert code
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
    {
        GridEditFormInsertItem insertItem = e.Item as GridEditFormInsertItem;
        string name = (insertItem["Name"].FindControl("txbName") as RadTextBox).Text;
        string Cate= (insertItem["IDCate"].FindControl("cboCate") as DropDownList).SelectedValue;
        RadAsyncUpload radAsyncUpload = insertItem["Pic"].FindControl("AsyncUpload1") as RadAsyncUpload;
 
        UploadedFile file = radAsyncUpload.UploadedFiles[0];
        byte[] pic= new byte[file.InputStream.Length];
        file.InputStream.Read(hinh, 0, (int)file.InputStream.Length);
        //file.InputStream.re
        //string hinh = con.ImageToByteArray(b);CONVERT(varbinary(30), @nvarcharParam)
        con.ExecuteSQL("INSERT INTO Hinh(IDCate, Name, Pic) VALUES(" + Cate+ ", N'" + name + "',CONVERT(varbinary(50),'" + pic + "'))");
    }

ASPX file
<telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" ShowStatusBar="True" GridLines="None"
             PageSize="3"
            OnNeedDataSource="RadGrid1_NeedDataSource" OnInsertCommand="RadGrid1_InsertCommand">
            <PagerStyle Mode="NumericPages" AlwaysVisible="true"></PagerStyle>
            <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="ID">
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton">
                        <HeaderStyle Width="36px"></HeaderStyle>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn HeaderText="ID" UniqueName="ID" SortExpression="ID" Visible="false">
                        <ItemTemplate>                           
                        </ItemTemplate>
                        <EditItemTemplate>                           
                        </EditItemTemplate>
                        <HeaderStyle Width="30%"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Name" UniqueName="Name" SortExpression="Name">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblName" Text='<%# Eval("Name") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadTextBox runat="server" Width="200px" ID="txbName" Text='<%# Eval("Name") %>'>
                            </telerik:RadTextBox>
                            <asp:RequiredFieldValidator ID="Requiredfieldvalidator1" runat="server" ControlToValidate="txbName"
                                ErrorMessage="Please, enter a name!" Display="Dynamic" SetFocusOnError="true"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <HeaderStyle Width="30%"></HeaderStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn HeaderText="Cate" UniqueName="IDCate" DataField="IDCate" >
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblCate" Text='<%# Eval("CateName") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate
                            <asp:DropDownList ID="cboCate" runat="server"  Width="200px" DataTextField="Cate" DataValueField="IDCate" DataSource="<%# loadCate() %>" SelectedValue='<%#  Bind("IDCate") %>'  AppendDataBoundItems="True" >
                            <asp:ListItem Selected="True" Text="Select" Value="">
                            </asp:ListItem>
                            </asp:DropDownList>                               
                        </EditItemTemplate>
                        <ItemStyle VerticalAlign="Top"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Pic" HeaderText="Pic" UniqueName="Pic">
                        <ItemTemplate>
                            <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#  Eval("Pic") %>'
                                AutoAdjustImageControlSize="false" Height="80px" Width="80px" ToolTip='<%#Eval("Pic", "Photo of {0}") %>'
                                AlternateText='<%#Eval("Pic", "Photo of {0}") %>'></telerik:RadBinaryImage>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="OnClientFileUploaded"
                                AllowedFileExtensions="jpg,jpeg,png,gif" MaxFileSize="1048576" OnFileUploaded="AsyncUpload1_FileUploaded">
                            </telerik:RadAsyncUpload>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton">
                        <HeaderStyle Width="36px"></HeaderStyle>
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="ImageButton">
                    </EditColumn>
                </EditFormSettings>
                <PagerStyle AlwaysVisible="True"></PagerStyle>
            </MasterTableView>
        </telerik:RadGrid>

And my table 
ID : int
IDCate: int
Name: nvarchar(50)
Pic: image (I try varbinary, text but it's not working)

P/S sorry for my english.
Do Xuan
Top achievements
Rank 1
 answered on 27 Oct 2014
12 answers
353 views
Dear Telerik-Staff,

I want to make my RadGrid occupy 100% of a RadPane's height, the grid is in.

I have taken the WebMail-Demo: The relevant part looks like this:
<telerik:RadPane runat="server" ID="contentPane" Scrolling="none">               
                <telerik:RadSplitter runat="server" ID="RadSplitter2" BorderStyle="None" PanesBorderSize="0">
                    <telerik:RadPane runat="Server" ID="leftPane" Width="240px" MinWidth="240" MaxWidth="240" Scrolling="None">
                        <telerik:RadSplitter runat="server" ID="RadSplitter3" BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal">
                            <telerik:RadPane runat="server" ID="topLeftPane">
                                <div class="contentBorders">
                                    <asp:ContentPlaceHolder ID="ContentPlaceHolderNavigationModules" runat="server" />
                                </div>
                            </telerik:RadPane>
                            <telerik:RadSplitBar runat="server" ID="RadSplitBar3" CollapseMode="Backward" EnableResize="false"  />
                            <telerik:RadPane runat="server" ID="bottomLeftPane" Height="68px">
                                <telerik:RadPanelBar runat="server" ID="panelBarBottomLeft" Width="100%">
                                    <Items>
                                        ---The Items
                                    </Items>
                                </telerik:RadPanelBar>
                            </telerik:RadPane>
                        </telerik:RadSplitter>
                    </telerik:RadPane>
                    <telerik:RadSplitBar runat="server" ID="RadSplitBar1" CollapseMode="Forward" />
                    <telerik:RadPane runat="Server" ID="rightPane" CssClass="right-pane" Scrolling="Both" OnClientResized="ClientResized" Height="100%">
                        <asp:ContentPlaceHolder ID="MainContent" runat="server" />           
                    </telerik:RadPane>
                </telerik:RadSplitter>
            </telerik:RadPane>
        </telerik:RadSplitter>

The AJAX-Code for the OnClientResized-Event looks like this:
<telerik:RadCodeBlock ID="codeBlock" runat="server">
<script type="text/javascript">
function ClientResized(sender, eventArgs) {
$find("<%= AjaxManagerMasterPage.ClientID %>").ajaxRequest('ChangePageSize');
}
</script>
</telerik:RadCodeBlock>

I have a site containing my RadGrid (it is not nested into any other controls except the contentplaceholder) and on this site I add the following in the PageLoad-Event:
AjaxManager = (RadAjaxManager)this.Master.Master.FindControl("AjaxManagerMasterPage");
AjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(AjaxManager_AjaxRequest);
AjaxManager.AjaxSettings.AddAjaxSetting(AjaxManager, MyRadGrid, RadAjaxLoadingPanel1);

And finally the AjaxRequest-Event looks like this:

void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            switch (e.Argument.ToString())
            {
                case "ChangePageSize":
                    //Make the grid fit the full pane size
                    Unit masterPaneWidth = ((RadPane)this.Master.Master.FindControl("rightPane")).Width;
                    Unit masterPaneHeight = ((RadPane)this.Master.Master.FindControl("rightPane")).Height;
                     
                    MyRadGrid.Width = new Unit(masterPaneWidth.Value - 2);                  
                    MyRadGrid.Height = new Unit(masterPaneHeight.Value - 2);  
                 
                    break;
            }
        }

Now to my problem:

When I access the page the RadGrid doesn't occupy the total height of the rightPane. When clicking on the splitbar, the grid is resized properly in its height and width. So this perfectly works.

But I can't get it to run on the initial page load. When I call the RaisePostbackEvent of the AjaxManager the page crashes saying that a negative value for the width and height of the pane is not allowed (caused in the AjaxRequest-Event when subtracting 2 from the rightPane's width).

Then I did the following: Set the leftPane to Collapsed (Collapsed="true"). When accessing the page with this setting, the leftPane is collapsed and the Resized-Event is raised on initial page load. This works as expected but not if I have the leftPane set to Collapsed="false" on the initial PageLoad.

I hope that you can help me. I've spent the entire day trying to fix this. Do you have any idea for me??

Best regards,
Marco
Maria Ilieva
Telerik team
 answered on 27 Oct 2014
0 answers
87 views
I have gantt chart Its work fine in chrome browser but in Firefox and IE its not show correctly. Please check attached screen shot. I tried to set MonthView-SlotWidth but its not fix my issue.
Programmer
Top achievements
Rank 1
 asked on 27 Oct 2014
1 answer
198 views
Hi Team,

I am having three text boxes in the form.
I need to populate the other two text box values based on the value in the first text box value.
These values are coming from database.
ASPX FILE:

  <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal ID:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalId" runat="server" >
                             
                        </telerik:RadTextBox>
                        <asp:RequiredFieldValidator ID="txtTerminalIdValidator" runat="server" Display="Dynamic"
                            ControlToValidate="txtTerminalId" ErrorMessage="TerminalId can not be empty!"></asp:RequiredFieldValidator>
                       
                    </td>
                </tr>                <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal Name:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalName" runat="server"></telerik:RadTextBox>
                       
                    </td>
                </tr>                <tr class="FormContainer">
                    <td style="white-space: nowrap;">
                        Terminal Address:
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtTerminalAddress" runat="server"></telerik:RadTextBox>
                       
                    </td>
                </tr>
When i Type Terminal Id in the textbox,Terminal name and terminal address needs to populate automatically.
These values are coming from the database.

protected void plantIdChanged(object sender, EventArgs e)
    {
       
        Int64 plant_id = Convert.ToInt64(txtTerminalId.Text);        var depots = loadingManager.GetLoadingSite(plant_id).FirstOrDefault(x => x.Plant_ID == plant_id);
        if (depots != null)
        {
            txtTerminalName.Text = depots.PlantText;
            txtTerminalAddress.Text = depots.Street + " " + depots.Zipcode;
        }
       
    }
   
plantIdChanged m
ethod is used for get terminal name and terminal address from database based on the terminalid(plant_id).
Need to implement it in Onblur event of the text box.

Can any one please help,how to implement this.


Viktor Tachev
Telerik team
 answered on 27 Oct 2014
5 answers
156 views
Hi Team,

i have a grid which is having some rows in it.I need to implement editing functionality for each row in the grid.
i am using the editmode=batch properity for this to achieve.
once edit has completed i need to update the changes  in the database when i click on the save changes button.
and also cancel changes by clicking on the cancel button.
i am also need to implement add a new record and update the new record in to the database.

ASPX File:
<telerik:RadGrid ID="RadGrid1" OnItemDataBound="RadGrid1_OnItemDataBound"
runat="server" AutoGenerateColumns="false" CssClass="TransferGridPanel" Height="375px"
Width="500px" OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" onItemUpdated="RadGrid1_ItemUpdated"
OnBatchEditCommand="RadGrid1_BatchEditCommand" OnItemInserted="RadGrid1_ItemInserted"
 OnItemCommand="RadGrid1_ItemCommand" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
   <MasterTableView ShowHeadersWhenNoRecords="true" CommandItemDisplay="Top" EditMode="Batch">
    <BatchEditingSettings EditType="Cell" />
<Columns>
          <telerik:GridBoundColumn UniqueName="Id" DataField="Loading_ID">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn UniqueName="TerminalId" DataField="Plant_ID">
          </telerik:GridBoundColumn>
          <telerik:GridBoundColumn UniqueName="TerminalName" DataField="TerminalName">
          </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="StartTime" dataField="LoadingStartTime">
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="EndTime" DataField="LoadingEndTime">
         </telerik:GridBoundColumn>
</Columns>

How to achieve the above operations  in codebehind file.
​
Viktor Tachev
Telerik team
 answered on 27 Oct 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?