Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
323 views
I have a radgrid with a datepicker and I can bind the raddatepicker when a dae exists in the database, but the date to start out is always NULL and can be left null, right now I get an error on bind when trying to bind if the db is null, how can I bind if a date exists but if nothing exists show no date.   In my sql code I can do a
Case when dtRecoverTemp IS NULL then '' ELSE dtRecoverTemp END dtRecoverTemp,

but what happens then is it puts in 1900-01-01 for date and I want it to show nothing.

<telerik:GridTemplateColumn HeaderText="TEMP_DT">
                                                                    <ItemTemplate>
                                                                            <telerik:RadDatePicker ID="DatePicker" runat="server" PopupDirection="BottomRight" AutoPostBack="false" Width="120px" EnableShadows="true" ShowPopupOnFocus="true" 
                                                                            DatePopupButton-Visible="false" DateInput-CssClass="pointer" SkinID="Web20" SelectedDate='<% #bind ("dtRecoverTemp") %>' >
                                                                            <DateInput runat="server" DisplayDateFormat="yyyy/MM/dd" DateInput-CssClass="pointer"></DateInput></telerik:RadDatePicker>
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>


Kevin
Top achievements
Rank 1
 answered on 05 May 2012
1 answer
733 views
Hi,

I am using telerik radgrid and binding the data to it. I have a separate button named 'Export To Excel'. When I click on that button it needs to

export all the records from the grid to excel. For huge datasets when I try to export it gives me out of memory exception error.

Is there anyway I can capture this exception error in my web page.

The function that I use to export to excel is below. I would like to capture that exception in the below function.

Could you please help me to achieve this.

Private Sub btnPrintAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrintAll.Click
        Try
            Dim radGridExport As RadGrid
            If Me.Parent.Page.Title = "Database Circle Search" Then
                strCallingPage = "CIR"
            ElseIf Me.Parent.Page.Title = "Database Search" Then
                strCallingPage = "SEA"
            End If

            If Not Session("MILUSER") Is Nothing Then
                IsMilUser = CType(Session("MILUSER"), Boolean)
            Else
                IsMilUser = False   ' If object not in session then make it false
            End If

            Dim blnfromSrchUsrCtl As Boolean = True
            Dim blnfromCustGrid As Boolean = False
            Dim blnFromPrintAll As Boolean = True
   

            Dim startTick As Long = DateTime.Now.Ticks
            Dim endTick As Long
            Dim tick As Long
            Dim milliseconds As Long
            Dim microseconds As Long

            strColOrder = ViewState("Column Order")

            If Me.Parent.Page.Title = "Database Search" Then
                Dim objPage As SearchDB
                objPage = CType(MyBase.Page, Page)
                If Not objPage Is No
                    objPage.CustomizeGridColumns(strColOrder, blnfromSrchUsrCtl)
                Else
                    Exit Sub
                End If
            ElseIf Me.Parent.Page.Title = "Database Circle Search" Then
                 If Not IsMilUser Or Not IsEASearch Then
                    Dim objPage As CircleSearchDB
                    objPage = CType(MyBase.Page, Page)
                    If Not objPage Is Nothing Then
                        objPage.CustomizeGridColumns(strColOrder, blnfromSrchUsrCtl)
                    Else
                        Exit Sub

                    End If
                End If
            End If

            radGridExport = CType(Me.FindControl("grdExport"), RadGrid)
            If IsMilUser And strCallingPage = "CIR" And IsEASearch Then
                radGridExport.ExportSettings.IgnorePaging = True
                radGridExport.ExportSettings.OpenInNewWindow = True
                radGridExport.ExportSettings.ExportOnlyData = True
                radGridExport.MasterTableView.ExportToExcel()
            Else
              
                grdResult.MasterTableView.GetColumn("SEL").Display = False
                grdResult.ExportSettings.IgnorePaging = True
                grdResult.ExportSettings.OpenInNewWindow = True
                grdResult.ExportSettings.ExportOnlyData = True
                grdResult.MasterTableView.ExportToExcel()

                If grdResult.MasterTableView.GetColumn("FRQ").Visible = True Then
                    grdResult.MasterTableView.GetColumn("FREQ").Visible = True
                Else
                    grdResult.MasterTableView.GetColumn("FREQ").Visible = False
                End If
             

            End If
          
        Catch ex As Exception
            AFMCommonUtils.LogError(CType(Me.Session("User"), AFMBusinessLogicLayer.UserBL).USERNAME, "UsrSearchResult", "btnPrintAll_Click", ex.Message, ex.StackTrace)
            ClearModuleTracker()
            Response.Redirect("~/ErrorDisplay.aspx")
        End Try
    End Sub

 

Jayesh Goyani
Top achievements
Rank 2
 answered on 05 May 2012
1 answer
87 views
Hello!
I've been searching for many eons it seems, to get a solution to something that shouldn't be that hard.  i have a radgrid with a formtemplate that saves nicely.  On display in the radgrid header are some fields useful to the user but not all data is in the header.  on editing a row, there are listboxes that need to bind to the proper id - this is my issue - they don't bind by themselves on edit.  Again, the id's for these listboxes are not in the header.

I'm showing a sample of the form here.  (i've noticed there are a lot of uses of "Itemid" as the key to the grid and the listbox, but that shouldn't be an issue since they use different data sources.)
<telerik:RadGrid ID="RadGridPlantedPlants" runat="server"  >
<PagerStyle Mode="NumericPages" AlwaysVisible="true" />
 
<MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ItemId"  >
<Columns>
            
    <telerik:GridBoundColumn UniqueName="anItem" HeaderText="ItemId" DataField="ItemId">
        <HeaderStyle Width="60px"></HeaderStyle>
    </telerik:GridBoundColumn>
     
    <telerik:GridBoundColumn UniqueName="uName" HeaderText="name" DataField="name">
    </telerik:GridBoundColumn>
     
</Columns>
 
<EditFormSettings InsertCaption="Add new item" CaptionFormatString="Edit ItemId: {0}"
    CaptionDataField="ItemId" EditFormType="Template" PopUpSettings-Modal="true"
     FormTableItemStyle-HorizontalAlign="Justify">
     
    <FormTemplate>
     
                 
      <table id="TableLayout"  cellspacing="3" cellpadding="5" width="340" border="0">
    
        <tr>
            <td>
                Location:<br />(Largest geographical area)<br />
                <telerik:RadComboBox ID="plantingLocationsCombo" runat="server"       
                    DataTextField="name"
                    DataValueField="ItemId"
                    DataSourceID="Objectdata_plantingLocations"
                    Width="200px">
                </telerik:RadComboBox>
             
        </tr>
         
    </table>    
        
    </FormTemplate>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>
</telerik:RadGrid>

So, of the many examples i've come across, this below seems to be the closest to getting what i need done.  It works fine when there is no formtemplate.  Most of the pieces are in place, but i just can't get my hands on the data in order to tie the listboxes to the data. 

What is really frustrating, is that editformitem.DataItem is available in the debugger and shows all the values from the database but I cannot get my hands on them.

I've seen examples making use of GridDataKeyArray DataKeyValues , parentTables, DataRow[] and hashtable but something is just not clicking.  The example here crashes on examining the GetDataKeyValue.

protected void RadGridPlantedPlants_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
GridEditFormItem editFormItem = e.Item as GridEditFormItem;
//editFormItem.DataItem in debugger shows everything - but I can't get a handle to it
RadComboBox plantingLocationsCombo = (RadComboBox)editFormItem.FindControl("plantingLocationsCombo");
if (editFormItem.ItemIndex != -1) //when = -1 is a new item
{
plantingLocationsCombo.SelectedValue = editFormItem.GetDataKeyValue("pcat_tbllu_location_id").ToString();
}
}
}


Someone's help is greatly appreciated!!!

T
Top achievements
Rank 1
 answered on 05 May 2012
1 answer
351 views
Can somebody help me to integrate this source code into a Telerik asp.net ajax?

http://zeeshanumardotnet.blogspot.mx/2010/11/how-to-keep-session-alive-in-aspnet.html

I need to have an intranet with no session timeout lost.
John
Top achievements
Rank 1
 answered on 05 May 2012
2 answers
473 views
Hi I am trying the set the SelectedValue in the item databound event as follows
Protected Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound  
       If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
            Dim editform As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
           Dim combo As RadComboBox = DirectCast(editform.FindControl("RadComboBox1"), RadComboBox)
           combo.SelectedValue = "123
       End If
End Sub

and this works as it is, but I actually want to have the SelectedValue set to a specific column value of the selected row, but I am not sure how I can get this value at this point

Basically I am trying to replicate what happens declaratively when you have SelectedValue='<%# Bind("ColumnName") %>'  but be able to intercept the value in case it does not exist in the list of values in the combobox and causes the 'Out of range' error.

Please advise !
Mike
Top achievements
Rank 2
 answered on 04 May 2012
1 answer
134 views
ive got a function in the code behind that automatically adds an expression on a tab click on a mutli page.
but clicking back a tab simply creates another one.
how can i clear it FIRST AND THEN add the expression. i was hoping the RecreateControl would work

 

 

protected void showfilterTabs(int tab)

 

{

 

 

if (tab == 0)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

 

expr1.Value =

 

"";

 

WorkOrdersRadFilter.RootGroup.AddExpression(expr1);

WorkOrdersRadFilter.RecreateControl();

}

 

 

else if (tab == 1)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

 

expr1.Value =

 

"";

 

WorkOrderItemsRadFilter.RootGroup.AddExpression(expr1);

WorkOrderItemsRadFilter.RecreateControl();

}

 

 

else if (tab == 2)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

 

expr1.Value =

 

"";

 

SearchAllOrdersRadFilter.RootGroup.AddExpression(expr1);

SearchAllOrdersRadFilter.RecreateControl();

}

 

 

else if (tab == 3)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

 

expr1.Value =

 

"";

 

StorageWorkOrdersRadFilter.RootGroup.AddExpression(expr1);

StorageWorkOrdersRadFilter.RecreateControl();

}

 

 

else if (tab == 4)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERNUMBER");

 

expr1.Value =

 

"";

 

SearchAllItemsRadFilter.RootGroup.AddExpression(expr1);

SearchAllItemsRadFilter.RecreateControl();

}

 

 

else if (tab == 5)

 

{

 

 

RadFilterStartsWithFilterExpression expr1 = new RadFilterStartsWithFilterExpression("WORKORDERITEMDISPLAY");

 

expr1.Value =

 

"";

 

InventoriesRadFilter.RootGroup.AddExpression(expr1);

InventoriesRadFilter.RecreateControl();

}

}

rik butcher
Top achievements
Rank 1
 answered on 04 May 2012
4 answers
240 views
I am creating a Hierarchical grid programmatically by using a radgrid with a GridTableView.  This is generated fine without issue.  What I would like to do is have a row click on the gridtableview rows as well as the mastertable rows.  So when I click the expand icon on the main grid, the sub rows will fire the same rowclick.  Which does happen, howeveer I can not seem to get hold of the datakeyvalue of the gridtableview.  For example, my javascript rowclick,
function RowClick(sender, eventArgs) {
    eval(eventArgs.getDataKeyValue("ROWCLICK"));
}
RowClick fires fine, but the getDataKeyValue is always null for the sub rows (which i believe is the gridtableview).  Any help with this would be much appreciated.

I have a similar issue with the contextmenu, but I guess it would be related to getting the datakeyvalue for the gridtableview.
mabs
Top achievements
Rank 1
 answered on 04 May 2012
3 answers
93 views
Good afternoon. I am currently experiencing a problem. I am using the RadWindow as a dialog and allowing the user to fill out information on the dialog. When the dialog is closed, I am retrieving the values from the dialog (using the exact same technique described here:http://demos.telerik.com/aspnet-ajax/window/examples/dialogreturnvalue/defaultcs.aspx)  and setting them as values on the parent browser window. The textboxes that I am populating are inside of a RadGrid. They populate just fine but if I click the Cancel button after populating them, I get the following error:

'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: Setup.' when calling method: [nsIDOMEventListener::handleEvent]

Any help would be appreciated.

Marin Bratanov
Telerik team
 answered on 04 May 2012
1 answer
86 views
Hi,
I have a problem with radwindow. When I open pdf in radwindow and move this radwindow the element send other request and reload the pdf everytime, when I open normal html page not sent other request.


Can I move without everytime reloading?

Thank you.


<head runat="server">
    <title></title>
    <script type="text/javascript">
        function LoadUrl() {
            //var windowURL = document.getElementById("url").value;
            var oWnd = radopen("http://www.kernel.org", null);
            oWnd.setSize(900, 400);
            oWnd.center();
        }
 
        function LoadPdf() {
            var oWnd = radopen("http://www.irs.gov/pub/irs-pdf/fw4.pdf", null);
            oWnd.setSize(900, 400);
            oWnd.center();
        }
 
        function LoadGoogle() {
            var oWnd = radopen("https://docs.google.com/gview?url=http://www.irs.gov/pub/irs-pdf/fw4.pdf", null);
            oWnd.setSize(900, 400);
            oWnd.center();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     
        <telerik:RadScriptManager runat="server"></telerik:RadScriptManager>
 
        <input type="button" id="url" value="Open Url" onclick="LoadUrl()" />
        <input type="button" id="Button1" value="Open Pdf" onclick="LoadPdf()" />
 
        <telerik:RadWindowManager ID="rwm" Modal="true" runat="server"></telerik:RadWindowManager>
 
    </div>
    </form>
</body>
</html>
Marin Bratanov
Telerik team
 answered on 04 May 2012
6 answers
233 views
is there a way in the code behind on page load to automatically make the rad filter default as if a user has clicked
the "And" - see screenshot
. it would be great if i could default this to behave as if the user had clicked the "Add Expression" button.
any help is appreciated.
thanks again
rik


 <telerik:RadFilter ID="WorkOrdersRadFilter" runat="server" Skin="WebBlue" ShowApplyButton="true"
                        OnApplyExpressions="WorkOrdersRadFilter_Apply" ApplyButtonText="Filter Work Orders"
                        OnPreRender="WorkOrdersRadFilter_PreRender" OnFieldEditorCreating="RadFilter_FieldEditorCreating"   OnItemCommand="WorkOrdersRadFilter_ItemCommand">
                       
                        <FieldEditors>
                            <telerik:RadFilterTextFieldEditor FieldName="WORKORDERNUMBER" DisplayName="Work Order#"
                                DataType="System.String" />  </FieldEditors>
                                  
</telerik:RadFilter>
rik butcher
Top achievements
Rank 1
 answered on 04 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?