Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
1.2K+ views
I would like to find out in the ItemCreated event if one of the rows in the grid is in edit mode.

I am using InPlace editing and I would like to prevent the user from clicking one of the other commands in rows that are not in edit mode.
Also I need to disable some other fields in my form if the user is editing an item.
Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
4 answers
271 views
I have a checkbox in commanitem template.
I display the checkbox based on some values in the database and change the text of the checkbox accordingly.

On the first page load, my checkbox does not retain the values i set in the prerender event. After i do some postback (via the button in the itemtemplate) it displays the checkbox correctly. I set the grid in edit mode in my pre render event.

below is my code:
        protected void rgFunds_PreRender(object source, EventArgs e)
        {
            Button btnPostTransaction = (Button)rgFunds.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("btnPostTransaction");
            CheckBox chkAutoRebalance = (CheckBox)rgFunds.MasterTableView.GetItems(GridItemType.CommandItem)[0].FindControl("chkAutoRebalance");
 
            //Puts the grid in editmode
            if (!IsPostBack)
            {
                foreach (GridItem item in rgFunds.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        editableItem.Edit = true;
                    }
                }
                rgFunds.Rebind();
            }
 
            //Set the AutoRebalance flag
            foreach (GridDataItem item in rgFunds.Items)
            {
                HtmlInputHidden _fundID = (HtmlInputHidden)item.FindControl("_fundID");
                int OnOff = Int32.Parse(_fundID.Value);
                chkAutoRebalance.Checked = OnOff == 1 ? true : false;
            }
 
            // Get the AutoRebalancing flag from plan settings
            if (ShowPostTransactionButton && IsCurrentEmployee && _allocationType == FundAllocation.AllocationType.Rebalance)
            {
                DataTable dtAutoRebalanceFrequency = FundRebalance.GetAutoRebalanceFrequencyByPlan(base.PlanID, DateTime.Now);
 
                if (dtAutoRebalanceFrequency.Rows.Count > 0)
                {
                    AutoRebalanceFrequency = dtAutoRebalanceFrequency.Rows[0][FundRebalance.Fields.RebalanceFrequency].ToString();
 
                    if (dtAutoRebalanceFrequency.Rows[0][FundRebalance.Fields.RebalanceFrequencyID].ToString() == ((int)FundRebalance.AutoRebalanceFrequency.NotAllowed).ToString())
                    {
                        chkAutoRebalance.Visible = false;
                        chkAutoRebalance.Checked = false;
                    }
                    else
                    {
                        chkAutoRebalance.Visible = true;
                        chkAutoRebalance.Text = "Auto Rebalance (" + AutoRebalanceFrequency + ")";
                    }
                }
                else
                {
                    chkAutoRebalance.Visible = false;
                    chkAutoRebalance.Checked = false;
                }
            }           
        }
 
Grid declaration:
 
<telerik:RadGrid ID="rgFunds" runat="server" AllowSorting="False" EnableViewState="false"
                        GridLines="Both" AllowMultiRowEdit="true" OnPreRender="rgFunds_PreRender" OnItemDataBound="rgFunds_ItemDataBound"
                        OnItemCommand="rgFunds_ItemCommand" OnNeedDataSource="rgFunds_NeedDataSource">
                        <MasterTableView TableLayout="Fixed" HierarchyDefaultExpanded="true" CommandItemDisplay="Bottom"
                            EditMode="InPlace" EnableNoRecordsTemplate="true">
                            <CommandItemTemplate>
                                <table width="100%">
                                    <tr>
                                        <td colspan="4" align="left">
                                            <asp:CheckBox ID="chkAutoRebalance" runat="server" Visible="true" ForeColor="White"
                                                OnCheckedChanged="chkAutoRebalance_CheckedChanged" />
                                        </td>
                                        <td align="right">
                                            <asp:Button ID="btnPostTransaction" runat="server" Text="Post Transaction" CssClass="button"
                                                CommandName="PostTransaction" />
                                        </td>
                                    </tr>
                                </table>
                            </CommandItemTemplate>
                            <Columns>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
                                    FooterStyle-HorizontalAlign="Left" UniqueName="InvestmentOptions" ReadOnly="true"
                                    HeaderText="Investment Options">
                                    <ItemTemplate>
                                        <asp:Label ID="_fundName" runat="server" Text='<%# Eval("fundName")%>'></asp:Label>
                                        <asp:CheckBox ID="_excludeFund" runat="server" Checked='<%# Eval("allowRebalanceExclude")%>'
                                            Text="Exclude?" Visible='<%# Eval("allowRebalanceExclude")%>' />
                                        <input type="hidden" id="_fundID" runat="server" />
                                        <input type="hidden" id="_autoRebalanceFlag" runat="server" />
                                        <input type="hidden" id="_allowRebalance" runat="server" />
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <strong>Total must equal 100%</strong></FooterTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" HeaderText="Current %"
                                    HeaderStyle-Width="25%" ReadOnly="true" DataField="currentPercent" UniqueName="currentPercent">
                                    <ItemTemplate>
                                        <asp:Label ID="_currentPercent" runat="server" Text='<%# Eval("currentPercent", "{0:N2}%")%>'>
                                        </asp:Label></ItemTemplate>                                 
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" UniqueName="futurePercent"
                                    HeaderStyle-Width="25%" HeaderText="New %">
                                    <ItemTemplate>
                                        <asp:Label ID="_futurePercent" runat="server" Text='<%# Eval("futurePercent", "{0:N2}%")%>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <asp:TextBox ID="txtNewPercent" runat="server" CssClass="percent" groupName="allocations"
                                            Width="40px" onchange="SumGroup(this, false)" Text='<%# Eval("futurePercent")%>' />
                                        %
                                        <asp:RangeValidator ID="newPercentageRange" runat="server" ControlToValidate="txtNewPercent"
                                            Type="Integer" CssClass="errormessagesmall" Display="None" />
                                        <asp:CustomValidator ID="newPercentageIncrement" runat="server" ControlToValidate="txtNewPercent"
                                            ClientValidationFunction="Mod_ClientValidate" CssClass="errormessagesmall" Display="None" />
                                        <cc1:ValidatorCalloutExtender ID="newPercentageRangeCallout" runat="server" TargetControlID="newPercentageRange"
                                            Width="235px" />
                                        <cc1:ValidatorCalloutExtender ID="newPercentageIncrementCallout" runat="server" TargetControlID="newPercentageIncrement"
                                            Width="235px" />
                                    </EditItemTemplate>
                                    <FooterTemplate>
                                        <asp:TextBox ID="fundTotal" runat="server" CssClass="percent" onfocus="blur()" Enabled="false"
                                            Font-Bold="true" ForeColor="Black" Width="40px" />
                                        %
                                        <asp:CompareValidator ID="totalEqual100" runat="server" ControlToValidate="fundTotal"
                                            ValueToCompare="100" Operator="Equal" CssClass="errormessagesmall" Display="None"
                                            ErrorMessage="New allocations must total 100%." />
                                        <asp:RequiredFieldValidator ID="fundTotalRequired" runat="server" ControlToValidate="fundTotal"
                                            Display="None" Visible="false" ErrorMessage="You <em>must</em> enter an allocation." />
                                        <cc1:ValidatorCalloutExtender ID="fundTotalRequiredCallout" runat="server" TargetControlID="fundTotalRequired"
                                            Width="235px" />
                                        <cc1:ValidatorCalloutExtender ID="totalEqual100Callout" runat="server" TargetControlID="totalEqual100"
                                            Width="235px" />
                                    </FooterTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>
Shinu
Top achievements
Rank 2
 answered on 04 Jun 2014
5 answers
309 views
I have attached a screen shot of my "Edit" Form that opens when I click on Edit from the RadGrid. I am trying to find out how you change the display/edit size of certian fields within the "Edit" Form.

For example the field "CorrectiveAction:" is a large "NText" field and I would like to increase the display/edit field in the Edit Form to show more of the field and even make it a scrollable field so you could see all the text in the field.

Another example is in the field "Status:" I would like to make it a dropdown list and not a free form list to all a user to pick an item and not free form the text.

Any help would be appriciated.

Thx,
Alex.

Princy
Top achievements
Rank 2
 answered on 04 Jun 2014
3 answers
351 views
Hi
i have bought licensed version of telerik tools and now i wanted to read barcode from a barcode image.

can any body plz provide me the ideas/code to achieve the above.

Thanks
San



Silvesterf
Top achievements
Rank 1
 answered on 04 Jun 2014
1 answer
218 views
Although I've got a support incident open on this, I thought I'd ask community members to also try a repro for me.

If anyone who uses the following technologies could try a repro, I’d be much obliged:

ASP.NET 3.5 web sites
VS 2013 Update 2
Telerik ASP.NET Ajax controls
 

My sample file is here: https://drive.google.com/file/d/0B6iyO5ZcnJjMWkI2SGhSTnhpNlk/edit?usp=sharing

The repro instructions are:
 
1. Extract the contents of the archive to a temporary folder,  C:\temp\TelerikWebSite1
2. In Visual Studio 2013 Update 2, File > Open > Website > C:\temp\TelerikWebSite1
3. Add the assemblies to the BIN folder from C:\Program Files (x86)\Telerik\UI for ASP.NET AJAX Q1 2014\Bin35
4. Attach the database found in the App_Data folder to SQL Server and fix the connection string in web.config.
5. In default.aspx.cs, in radgrid1_itemcreated, set a breakpoint.
6. Start debugging.

Before the breakpoint is hit the error appears:

JIT Compiler encountered an internal limitation.
InvalidProgramException: JIT Compiler encountered an internal limitation.]
  
Telerik.Web.SkinRegistrar.GetRuntimeSkin(ISkinnableControl control) +0 
Telerik.Web.UI.RadCompositeDataBoundControl.get_RuntimeSkin() +101
 
Telerik.Web.UI.GridTableView.OnInit(EventArgs e) +1215



Thanks for any help,


Ken


 
kencox
Top achievements
Rank 1
 answered on 03 Jun 2014
2 answers
120 views


Hi,

I have DB table that stores dates in UTC.  I’m using entity framework to connect data to
a RAD grid.

We modified EF to return all dates in local time (using T4
template).  Grid displays all dates
correctly.

We have filtering issue,
using raddatepicker.  It passes dates in
local time.  By the time it gets to
entity.Selecting, DataSource.Where is already set to value based on filter.  What would be the best way to make sure
filter passes UTC dates in to DataSource?

Regards,

Ralph Wiazowski

Ralph
Top achievements
Rank 1
 answered on 03 Jun 2014
2 answers
287 views
Hi. Good day

May I know is it possible to set both onMouseOver and OnClick to a RadToolTipManager's ShowEvent? I have a scenario where user can mouseover on the a customTemplate column to show tooltip of the item's description and when user click on it, it shows the tooltip with a textbox to update the value of the item in the radgrid.

Please advise on how to achieve this. Thanks in advanced.

Regards
Yung
chen
Top achievements
Rank 1
 answered on 03 Jun 2014
1 answer
188 views
Here are the problem details. If anyone has any ideas, I would appreciate it:
  1. Using ASP.NET AJAX Q2 2013 SP1
  2. Simple file upload page using RadUpload,RadProgressManagerand RadProgressArea  (see aspx page and web.config below)
  3. Progress bar moves and updates properly running on developer machine using IIS 7.5.
  4. But, when running on Windows 2008 R2 server using IIS 7.5, the following happens:
    • Progress bar does not move
    • The Uploaded percentage and byte count remain at zero during the upload.
    • The progress area filename is blank during the upload.
    • The file DOES successfully upload.
    • When upload is complete, upload percentage is 100% and byte count matches total file size.
  5. Used fiddler to compare dev machine vs server mid-progress traffic and noticed JSON progress status details are zero/blank when run on server. And they are correct when run on dev machine (see comparison below)
// Running on Server
var rawProgressData = {InProgress: true,
ProgressCounters: true,
CurrentOperationText: '',
PrimaryTotal: '168.26MB',
PrimaryValue: '0B',
PrimaryPercent: '0',
SecondaryValue: '0',
Speed: '0B/s',
TimeElapsed: '20311',
TimeEstimated: '2147483647',
OperationComplete: 'false',
RadUpload: { RequestSize: 176433547, Bytes: 0, FilesCount: 0, CurrentFileName: '', RequestLength: 176433547 }};

 

// Running on developer machine
var rawProgressData = {InProgress: true,
ProgressCounters: true,
CurrentOperationText: 'C:\\test\\test.zip',
PrimaryTotal: '168.26MB',
PrimaryValue: '102.49MB',
PrimaryPercent: '61',
SecondaryValue: '0',
Speed: '191.21MB/s',
TimeElapsed: '536',
TimeEstimated: '344',
OperationComplete: 'false',
RadUpload: { RequestSize: 176433596, Bytes: 107464352, FilesCount: 0, CurrentFileName: 'C:\\test\\test.zip',RequestLength: 176433596 }};

ASPX Page

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
    <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
    <telerik:RadUpload ID="RadUpload1" runat="server"
        TargetFolder="~/Test"
        MaxFileSize="400000000"
        ReadOnlyFileInputs="true"
        EnableFileInputSkinning="false"
        MaxFileInputsCount="1"
        ControlObjectsVisibility="None"
        OverwriteExistingFiles="True" 
        >
    </telerik:RadUpload>
    <telerik:RadProgressArea ID="RadProgressArea1" runat="server"
        ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, RequestSize, CurrentFileName, TimeElapsed, TimeEstimated, TransferSpeed" >
    </telerik:RadProgressArea>
   <asp:Button ID="UploadButton" runat="server" Text="Upload" />   
</div>
</form>

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
      <compilation strict="false" explicit="true" targetFramework="4.5">
        <assemblies>
          <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
          <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
          <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        </assemblies>
      </compilation>
      <httpRuntime targetFramework="4.5" maxRequestLength="500000" />
      <!--500 MB-->
      <httpHandlers>
        <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
        <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
      </httpHandlers>
    </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
      <add name="Telerik_RadUploadProgressHandler_ashx" verb="*" preCondition="integratedMode" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" />   
    </handlers>
    <modules>
      <add name="RadUploadModule" preCondition="integratedMode" type="Telerik.Web.UI.RadUploadHttpModule" />
    </modules>
      <security>
          <requestFiltering>
              <requestLimits maxAllowedContentLength="509715200"/>
              <!-- Max request/upload size=500MB for IIS-->
          </requestFiltering>
      </security>
  </system.webServer>
</configuration>

Thanks

Hristo Valyavicharski
Telerik team
 answered on 03 Jun 2014
2 answers
162 views
I'm using the FileExplorer in a RadWindow popup and the issue I'm experiencing is that the async upload window resizes beyond the popup window area when many files are uploaded.

Is there a way the the upload popup can maintain it size and just use a scrollbar?
Loy
Top achievements
Rank 1
Iron
 answered on 03 Jun 2014
8 answers
559 views
Is it possible to close the modal by clicking the overlay?

Something like you see with other modal scripts:

overlayClose: true | false Close modal box by clicking on overlay. Default is true.

Marc
Marin Bratanov
Telerik team
 answered on 03 Jun 2014
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?