Telerik Forums
UI for ASP.NET AJAX Forum
15 answers
182 views
From another post/sample i'm using the javascript below to resize my grid height to make the grid be 100% of a div tag. It works perfect, until i set the <ClientEvents OnGridCreated="oncreated" /> property. In the "oncreated" function i was just saving off a reference to grid for something later. For some reason setting that property cause my grid to resize and to be small.

 function oncreated() {
       var RadGrid1 = RadGrid1.gridObj();
   }

---  this is working without the <ClientEvents OnGridCreated="oncreated" />

<script>
   var $ = $telerik.$; //make jQuery available through $ alias

  
   function oncreated() {
       var RadGrid1 = RadGrid1.gridObj();
   }

   function pageLoad() {
       setGridHeight(); //set grid's height on page load
   }

   $(window).resize(function () {
       setGridHeight(); //maintain grid's height on window resize
   });

   function setGridHeight() {
       var headerHeight = $('.header').outerHeight(),  //header height including margin, padding and borders
footerHeight = $('.footer').outerHeight(),  //footer height including margin, padding and borders
windowHeight = $(window).height(),          //window height
gridObj = $find('<%= RadGrid1.ClientID%>'), //grid's client object

gridHeight = windowHeight - (headerHeight + footerHeight + 2); //calculate grid's height
                    $('#' + gridObj.get_id()).height(gridHeight);                  //set grid's height to the calculated
                    gridObj.repaint();                                             //it is required to repaint the grid so it can recalculate its metrics after window resize
                }
</script>

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" PageSize="50" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView Width="100%" TableLayout="Fixed">
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="true" UseStaticHeaders="true" />
                <ClientEvents OnGridCreated="oncreated" />
</ClientSettings>
</telerik:RadGrid>

    <style>
html,
body,
form {
height: 100%;
margin: 0;
padding: 0;
vertical-align: top;
}

.header {
height: 20px;
            background: green;
color: white;
}
.footer {
height: 20px;
background: green;
color: white;
}
</style>

Pavlina
Telerik team
 answered on 30 Mar 2015
3 answers
165 views
Hi,

I have a dashboard having multiple widgets. Some widgets containing radgrid with vertical scroll bar. when I apply UseStaticHeaders on grid then grid does not dispaly on screen in full width becasue some column and scroll bar goes into out of screen(see the image1). when i am undocking the menu of left side then grid display in full width on screen with scroll bar (see the image 2).

So how i will make grid to dispaly full width including scroll bar as well as usestaticheader is true in both condition either on menu doc or undock mode.

Please help.

Warm Regards,
Reyaz

Pavlina
Telerik team
 answered on 30 Mar 2015
1 answer
117 views
Hello,

is it possible to show the headers of the DetailTable in the MasterTableView only once?

You can see my grid in the attachment. I want to show all blue rows on top of the grid. The filtering functionality is required as well. Is there a way to do this? Any help is appreciated.
Konstantin Dikov
Telerik team
 answered on 30 Mar 2015
1 answer
279 views
Hi,

I use the "try...catch" in order to save the data to the server.
And I was exception handling in the "throw ex".

However, this doesn't display page when an error occurs.
So I have to debug to check the exception message.

In such a case, do I need to process How?

here my code.

aspx
    <title></title>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        function Update() {
            var batchManager = grid2.get_batchEditingManager();
            batchManager.saveChanges(grid2.get_masterTableView());
        }
......
<body>
    <form id="form" runat="server">
    <div>
       <telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" Height="100%" Width="100%" HorizontalAlign="NotSet" OnAjaxRequest="RadAjaxPanel2_AjaxRequest">
            <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" Culture="ko-KR" GroupPanelPosition="Top" OnNeedDataSource="RadGrid2_NeedDataSource" OnBatchEditCommand="RadGrid2_BatchEditCommand" OnItemCreated="RadGrid2_ItemCreated" Height="445px" OnPreRender="RadGrid2_PreRender" AllowAutomaticUpdates="True" ShowFooter="True">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowKeyboardNavigation="True">
                    <ClientEvents OnRowCreated="RowCreated" OnBatchEditCellValueChanged="RadGrid2_OnBatchEditCellValueChanged" />
                    <KeyboardNavigationSettings AllowSubmitOnEnter="True" CancelChangesKey="D1" />
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView EditMode="Batch" BatchEditingSettings-EditType="Cell">
                    <Columns>
............


aspx.cs
....................
        protected override void OnPreInit(EventArgs e)
        {
            baseScriptManager = new ScriptManager();
            baseScriptManager.AsyncPostBackTimeout = 600;
            Page.Items[typeof(ScriptManager)] = baseScriptManager;
 
            base.OnPreInit(e);
        }
 
        protected override void OnPreLoad(EventArgs e)
        {
            Page.Items[typeof(ScriptManager)] = null;
            baseScriptManager.AllowCustomErrorsRedirect = true;
            baseScriptManager.AsyncPostBackError += this.baseScriptManager_AsyncPostBackError;
 
            this.Form.Controls.Add(baseScriptManager);
 
            base.OnPreLoad(e);
        }
        private void baseScriptManager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
        {
            baseScriptManager.AsyncPostBackErrorMessage = e.Exception.Message;
        }
        protected void RadGrid2_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
        {
            ................
 
            using (DbConnection connection = db.CreateConnection())
            {
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();
                try
                {
                    DbCommand dbCommand = null;
                    foreach (DBParameter DBParameter in parameters)
                    {
                        dbCommand = db.GetStoredProcCommand("uspw_test1");
                        dbCommand.CommandTimeout = commandTimeout;
                        if (DBParameter != null)
                        {
                            foreach (Parameter parameter in DBParameter.ListParameter)
                                db.AddInParameter(dbCommand, parameter.Name, parameter.DBType, parameter.Value);
                        }
 
                        result += db.ExecuteNonQuery(dbCommand, transaction);
                    } 
                    // Commit the transaction
                    transaction.Commit();
                }
                catch (System.Exception ex)
                {
                    // Rollback transaction
                    transaction.Rollback();
                    throw ex;
                }
                connection.Close();
 
                return;
            }
        }
Angel Petrov
Telerik team
 answered on 30 Mar 2015
2 answers
89 views
Hi,

I am using asyncupload for storing files firstly in temp folder and then move to main folder after saving the records to the database.
I look around many demos given but not found the exact solution. The demos are so complicated.

Please give a simple example using only asyncuploader for my task.
I am be very thankful.

Thanks in advance..
Anuj
Top achievements
Rank 1
 answered on 30 Mar 2015
2 answers
241 views
Hi All,
Just wondering how can I disable Template Column Link button on Client side.
I wanted to change color, change cursor to default, not clickable and wont go to its link.
My code works for other databound column but for this template only through';
is working, all the rest is not applying at all.
Any info would be much appreciated.
Thanks in advance.

ASPX
<telerik:GridTemplateColumn HeaderText="Name" SortExpression="NAME" UniqueName="Name" HeaderTooltip="Name" DataField="NAME" HeaderStyle-Width="25%" ItemStyle-Width="25%" Exportable="true">
   <ItemTemplate>
      <asp:LinkButton id="lnkName" ForeColor="Blue" runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "NAME"))%>' CommandName="LAUNCH_NAME" CausesValidation="false"></asp:LinkButton>
   </ItemTemplate>
</telerik:GridTemplateColumn>


JS
function isTaskNA(chk,idx) {
var chkNA = document.getElementById(chk);
var masterTable = $find("<%=GrdMain.ClientID %>").get_masterTableView();
var PN = masterTable.get_dataItems()[idx].get_cell("Name");
var row = masterTable.get_dataItems()[idx].get_element();
   if (chkNA.checked){
   row.style.color = 'gray';
   row.style.textDecoration = 'line-through';
   row.style.fontStyle = 'italic';
   PN.style.ForeColor = 'gray';
   PN.disabled = 'disabled';
   }else {
   row.style.color = 'black';
   row.style.textDecoration = 'none';
   row.style.fontStyle = "normal";
   PN.style.ForeColor = 'blue';
   }
}

RJ
Top achievements
Rank 1
 answered on 30 Mar 2015
2 answers
143 views
Hello, I bind a grid programmatically using NeedDataSource.
Filtering, sorting, paging, all work perfectly.

myDataSource = new ObjectDataSource { ... };
myDataSource.Selecting += SourceSelecting;
...
 
private void SourceSelecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
     e.InputParameters["filterExpression"] = myGrid.MasterTableView.FilterExpression;
}

I have problems when SQL Server BIT columns are bound to a GridCheckBoxColumn and I allow filtering on it.
The problem is that in previous code the filter expression is something like ([MyBoolColumn] = True).
This expression is not valid when I pass it to SQL Server, because True is not a valid bit value (should be 1).

Is there any way to tell the grid to use 0/1 as filter values for GridCheckBoxColumns instead of False/True?

Thanks
Igor
Top achievements
Rank 2
 answered on 29 Mar 2015
1 answer
95 views
I followed your demo here:
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/showingwebcontrols/defaultcs.aspx

And got the show/hide to work great, however I have problems with the treeview after the showing/hiding. I can't click on most of the checkboxes any longer. See the screencast below. 

http://screencast.com/t/irAwzZBFg1

Any ideas?
Bill
Top achievements
Rank 1
 answered on 27 Mar 2015
7 answers
713 views
Hello,
I've got a basic project working that allows a user to "stamp" custom predefined text or statuses on an image. I have it now always adding the new text in the upper corner, but that may not be a good place for different images. Does anyone have any suggestions on a good way to allow the user to specify the position of the text before it is inserted. Ideally, I could allow them to drag it to the new location after I add the text, but from other posts, it doesn't appear that is possible.I'd like to avoid a custom popup dialog if I can, because right now, they just click a custom icon, and it stamps the predefined data.
Thanks,
Adrian
Marbry
Top achievements
Rank 1
 answered on 27 Mar 2015
7 answers
2.0K+ views
Hi all,

I found that EmptyText doesn't work properly for RadTextBox if it has TextMode=Password.
I use v.2012.2.607.35
Also, I noticed that it doesn't work even on demo page:
http://demos.telerik.com/aspnet-ajax/input/examples/radtextbox/firstlook/defaultcs.aspx 

Joe
Top achievements
Rank 2
 answered on 27 Mar 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?