Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
163 views
I have a PagerTemplate in my RadGrid. Inside is a LinkButton that is used to trigger the grid's ItemCommand event when the value of the dropdown containing the pages changes.

<

 

PagerTemplate>
<table border="0" cellpadding="2" cellspacing="0" style="height: 20px" align="right">
<tr>
<td valign="baseline">
<%# ((int)DataBinder.Eval(Container, "OwnerTableView.CurrentPageIndex")+ 1) * (int)DataBinder.Eval(Container, "Paging.PageSize") - 4%> 

 

 

-

<%

# ((int)DataBinder.Eval(Container, "OwnerTableView.CurrentPageIndex") + 1) * (int)DataBinder.Eval(Container, "Paging.PageSize") - 5 + (int)DataBinder.Eval(Container, "Paging.Count")%>  of

 

<%

# DataBinder.Eval(Container, "Paging.DataSourceCount")%>
|
<asp:LinkButton CssClass="pagination" ID="lbPrev" Enabled='<%# (int)DataBinder.Eval(Container, "OwnerTableView.CurrentPageIndex") !=0 %>' CommandName="Page" CausesValidation="false" CommandArgument="Prev" runat="server">  
<%=Resources.Resource.strPrev_Paging%></asp:LinkButton>

|

</td>

 

<td valign="baseline">
<%=Resources.Resource.strPage%><asp:DropDownList ID="tbPageNumber" CssClass="forminputcomboPagination" runat="server" onchange="javascript:this.disabled = true;this.nextSibling.click();" />

 

 

<asp:LinkButton CssClass="pagination" ID="LinkButton4" runat="server" CommandName="CustomChangePage"></asp:LinkButton>
</td>
<td valign="baseline"> 
|
<asp:LinkButton CssClass="pagination" ID="lbNext" Enabled='<%# (int)DataBinder.Eval(Container, "OwnerTableView.CurrentPageIndex") != (int)DataBinder.Eval(Container, "Paging.PageCount")-1 %>' CommandName="Page" CausesValidation="false" CommandArgument="Next" runat="server">
<%=Resources.Resource.strNext_Paging%></asp:LinkButton> 

 

 

</td>
</tr>
</table></PagerTemplate>

 

 

 

 

It worked fine until recently when I encountered an "Object doesn't support this property or method." error message when I select from the dropdown. In View Source, the entire grid is not visible. I tried using Style["Display"] instead of the Visible property but I still encounter the same error.

What can I do?

Autessa
Top achievements
Rank 1
 answered on 10 Mar 2009
1 answer
288 views
I'm using the edit form template to accomplish what I need to do but I'm running into 1 snag.

Here is my relevant code:

<EditFormSettings EditFormType="Template"
                    <FormTemplate> 
                   <div style="padding:25px; height:70px;"
                        <div style="width:100%; float:left; margin:0 auto; text-align:center; display:inline; "
                            <asp:Label ID="lblBw" runat="server" Text="B/W Volume: "  />             
                            <telerik:RadNumericTextBox ID="rtxtBwVolume" runat="server" CssClass="AlignRight" 
                                Culture="English (United States)" InvalidStyleDuration="100" MaxValue="100000" 
                                MinValue="0" ShowSpinButtons="True" Value="1000" Width="75px" > 
                                <IncrementSettings Step="1000" /> 
                                <NumberFormat AllowRounding="True" DecimalDigits="0"></NumberFormat> 
                            </telerik:RadNumericTextBox> 
                                <asp:Label ID="lblColor" runat="server" Text="Color Volume: " /> 
                                <telerik:RadNumericTextBox ID="rtxtColorVolume" runat="server" CssClass="AlignRight" 
                                Culture="English (United States)" InvalidStyleDuration="100" MaxValue="100000" 
                                MinValue="0" ShowSpinButtons="True" Value="1000" Width="75px" > 
                                <IncrementSettings Step="1000" /> 
                                <NumberFormat AllowRounding="True" DecimalDigits="0"></NumberFormat> 
                            </telerik:RadNumericTextBox> 
                            <asp:label ID="lblUnits" runat="server" Text="Units: " Visible="false"/> 
                            <asp:RadioButtonList ID="rblUnits" runat="server" RepeatLayout="flow"  
                                RepeatDirection="horizontal" EnableTheming="false"  Visible="false" > 
                                <asp:ListItem Value="3" Text="Feet" /> 
                                <asp:ListItem Value="4" Text="Meters" /> 
                            </asp:RadioButtonList> 
                        </div> 
                        <div style="width:100%; float:left; margin:0 auto; text-align:center; "
                            <asp:CheckBox ID="chkNoWarranty" runat="server" Text="No Warranty" /> 
                            <asp:CheckBox ID="chkFiery" runat="server" Text="Fiery" /> 
                            <asp:CheckBox ID="chkNewCustomer" runat="server" Text="New Customer" /> 
                        </div> 
                        <div style="width:100%; float:left; margin:0 auto; text-align:center; ">    
                            <asp:Button runat="server" ID="btnUpdate" Text="Update" CommandName="Update" /> 
                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel" /> 
                        </div> 
                    </div> 
                     
                    <asp:Panel ID="pnlError" runat="server" > 
                        <div style="text-align:center;"><asp:PlaceHolder id="PlaceHolder1" runat="server" /></div
                        <div style="text-align:center;  color:Red;"><des:ValidationSummary ID="ValidationSummary1" runat="server" Group="Volume" /></div
                    </asp:Panel> 
                    </FormTemplate> 
            </EditFormSettings> 

Protected Sub RadGrid1_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated 
 
    If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then 
      Dim editItem As GridEditableItem = TryCast(e.Item, GridEditableItem) 
      Dim txtbx As RadNumericTextBox = DirectCast(editItem.FindControl("rtxtBwVolume"), RadNumericTextBox) 
 
      Dim ent As MaPlansEquipmentEntity = MAM.GetMaEquipmentWithRates(editItem.GetDataKeyValue("MaPlansEquipmentId")) 
 
 
      Dim chkWarranty As CheckBox = DirectCast(editItem.FindControl("chkNoWarranty"), CheckBox) 
      Dim chkFiery As CheckBox = DirectCast(editItem.FindControl("chkFiery"), CheckBox) 
      Dim chkNewCust As CheckBox = DirectCast(editItem.FindControl("chkNewCustomer"), CheckBox) 
 
      chkWarranty.Checked = ent.NoWarrantyYn 
      chkFiery.Checked = ent.FieryYn 
      chkNewCust.Checked = ent.NewCustYn 
 
      Dim lblBw As Label = DirectCast(editItem.FindControl("lblBw"), Label) 
      Dim lblColor As Label = DirectCast(editItem.FindControl("lblColor"), Label) 
      Dim lblUnits As Label = DirectCast(editItem.FindControl("lblUnits"), Label) 
 
      Dim rtxtBwVolume As RadNumericTextBox = DirectCast(editItem.FindControl("rtxtBwVolume"), RadNumericTextBox) 
      Dim rtxtColorVolume As RadNumericTextBox = DirectCast(editItem.FindControl("rtxtColorVolume"), RadNumericTextBox) 
 
      Dim rblUnits As RadioButtonList = DirectCast(editItem.FindControl("rblUnits"), RadioButtonList) 
      rblUnits.SelectedValue = 3 
 
       
 
    End If 
  End Sub 


 Protected Sub RadGrid1_ItemCommand(ByVal source As ObjectByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand 
 
    If e.CommandName = "Update" Then 
      Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem) 
 
      Dim Id As Integer = editItem.GetDataKeyValue("MaPlansEquipmentRateId"
 
      Dim rtxtBwVolume As RadNumericTextBox = DirectCast(editItem.FindControl("rtxtBwVolume"), RadNumericTextBox) 
      Dim rtxtColorVolume As RadNumericTextBox = DirectCast(editItem.FindControl("rtxtColorVolume"), RadNumericTextBox) 
 
      Dim rblUnits As RadioButtonList = DirectCast(editItem.FindControl("rblUnits"), RadioButtonList) 
 
 
      Dim chkWarranty As CheckBox = DirectCast(editItem.FindControl("chkNoWarranty"), CheckBox) 
      Dim chkFiery As CheckBox = DirectCast(editItem.FindControl("chkFiery"), CheckBox) 
      Dim chkNewCust As CheckBox = DirectCast(editItem.FindControl("chkNewCustomer"), CheckBox) 
 
      Try 
        MAM.UpdateMachineNew(Id, rtxtBwVolume.Value, rtxtColorVolume.Value, rblUnits.SelectedValue, _ 
             chkWarranty.Checked, chkFiery.Checked, chkNewCust.Checked, Profile.UserId) 
 
        e.Item.Edit = False 
        Me.RadGrid1.Rebind() 
      Catch ex As Exception 
'Error code here 
      End Try 
       
    End If 
  End Sub 


My problem is when I click the btnUpdate button the Item_Created Sub is run first resetting any values that where changed.  I've tried initiating my template forms in the edit_command sub but they don't exist yet.  Is it possible to do what I want?



Yavor
Telerik team
 answered on 10 Mar 2009
1 answer
77 views
Hi!

I have a RadGrid with some data. I group this data for some criteria (I call, p.e., tableori).

GridGroupByExpression expression = new GridGroupByExpression(); 
GridGroupByField gridGroupByField = new GridGroupByField(); 
 
//Add select fields (before the "Group By" clause) - Campo de ruptura 
gridGroupByField = new GridGroupByField(); 
gridGroupByField.FieldName = "tableori"
gridGroupByField.FormatString = "<strong>{0}</strong>"
expression.SelectFields.Add(gridGroupByField); 
 
//Add a field for group-by (after the "Group By" clause) - Agrupación 
gridGroupByField = new GridGroupByField(); 
gridGroupByField.FieldName "tableori"
expression.GroupByFields.Add(gridGroupByField); 
 
assigGrid.MasterTableView.GroupByExpressions.Add(expression); 
assigGrid.MasterTableView.ShowGroupFooter = true




The trouble is when I try to change the message at GroupHeader. When I try to sort the grid or paging it, I have the exception "Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive"; but if I comment the lines inside the if otpion of GridGroupHeaderItem works fine.

protected void assigGrid_ItemCreated(object sender, GridItemEventArgs e) 
    try 
    { 
        if (defObjeto == null
        { 
            objeto = Request.QueryString["obj"]; 
            idioma = UtilControlSession.GetIdioma(Session); 
            wc = new WebCache(Cache, (string)Session[Constantes.SESS_APLICACION_ACTIVA], bdConnStr); 
            defObjeto = wc.GetObjetoAsignacionH(objeto, idioma); 
        } 
 
        if (e.Item is GridGroupHeaderItem) 
        { 
            GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item; 
 
            // Los datos que afectan a esta agrupación (criterio(s) de agrupación y subtotales si los hubiere) 
            DataRowView groupDataRow = (DataRowView)e.Item.DataItem; 
 
            int colSpan = item.Cells[1].ColumnSpan; 
            item.Cells.RemoveAt(1); 
 
            TableCell tc = new TableCell(); 
            tc.ColumnSpan = colSpan; 
            tc.HorizontalAlign = HorizontalAlign.Left; 
            tc.Text = "My title"
            item.Cells.Add(tc); 
        } 
    } 
    catch (Exception exc) 
    { 
    } 

Any ideas or suggestions to skip this problem?
Yavor
Telerik team
 answered on 10 Mar 2009
3 answers
143 views
2 days before i asked for the following problem -
im using alphabet paging in Radgrid, whenever we do paging the grid height increases or decreases as according to no. of records and pager(which is showing alphabets) doesn't remain in one location i.e i want it should get freezed at one location so that it does't look like flickering. is it possible?

To resolve this problem i tried setting the Height of the Grid to a fixed value, but by applying this im facing another problem is that grid header, body and footer height increase if no. of records is less than page size. is there any other solution for this?



Sebastian
Telerik team
 answered on 10 Mar 2009
1 answer
102 views
Hi all,

In my app, I have a RadGrid which I built dynamically by adding coulmns in the page_init()... One column is a GridTemplateColumn with a custom ItemTemplate. Everything works fine but I would like to know if there a way to get the column(GridTemplateColumn) reference in InstantiateIn method ?

public class myTemplate : ITemplate     
{     
    void ITemplate.InstantiateIn(Control container)      
    {     
        //want to get the reference of column here  
    }     

Thanks
Osman
Yavor
Telerik team
 answered on 10 Mar 2009
1 answer
86 views

I plan to make a RichEditor on ASP.NET, Design mode only.
Ideally, the main box border should always be a simple silver color 1px border, always. When user click the text area, the tool bar should show a band of icons.

I can make the main box with simple silver 1px border either in editing or non-editing by this:

 

 

 

 

 

 

 

 

EditModes="Design" 

 

 

 

EnableResize="False" EnableTheming="False" Height="600px" Skin="Vista"

 

 

 

ToolbarMode="ShowOnFocus" Width="500px" BorderColor="Silver" BorderWidth="1px" EnableAjaxSkinRendering="True" EnableEmbeddedBaseStylesheet="True" EnableEmbeddedSkins="False" ToolsWidth="500px" BorderStyle="Solid"

 

 

but this also makes the toolbar looks weired (no icons anymore,but tooltips still there).
How do I make the toolbar still show properly but only main box without skins?

 

Thanks a lot

 

 

 

 

 

 

 

 

Rumen
Telerik team
 answered on 10 Mar 2009
1 answer
131 views
Hi,
I'm using the following code to return the name of a document and the full path of a selected document:

fileName =

Me.RadUpload1.UploadedFiles(0).GetName()

 

filePath =

Me.RadUpload1.UploadedFiles(0).FileName

Question: If the filePath is something like X:\SomeFolder\SomeDocument.xls, for which X points to a mapped drive like \\servera\
How can I return the filePath with the actual server name? instead of the mapped drive letter?

So I want: \\servera\SomeFolder\SomeDocument.xls,
instead of X:\SomeFolder\SomeDocument.xls,

thanks

 

Ian Coetzer
Top achievements
Rank 2
 answered on 10 Mar 2009
1 answer
73 views
Hi,
How can I find out index of the selected node in the childeren of anothr node?
I have  a tree a root and others are childeren. I want to find the index of the selected childeren
Princy
Top achievements
Rank 2
 answered on 10 Mar 2009
8 answers
244 views
Hey there folks, hopefully someone can lend me a hand because I've been staring at this too long.

I'm using DNN, and have a module that uses RadSlidingPanes/RadPane/RadSlidingZone/RadSplitter.

On the left are tabs that slide out with different options.

On the right side is a RadGrid.

In IE7, Safari 3, Opera 9.6, and Chrome, it works fine.

In Firefox 3, the Radgrid appears for a split second and then disappears never to be seen again, and I have no idea why.

Does anyone have any idea?

By the way, I'm using the following DocType:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

I'm using this DocType because going into the "way-back" machine (a year ago or so), this was the only DocType that allowed (the old RadControls) to display in DNN correctly.  Could the DocType be the problem now?

Thanks for your Help!

Kuba
Dimo
Telerik team
 answered on 10 Mar 2009
3 answers
120 views
  When I have an inplace form displayed to enter new data. I have two dropdownlists in the form. I also have griditem rows displayed beneath the form. 
  Currently, when I hit refresh, I set the CurrentPageIndex=0 and the first griditem record displays. But the dropdownlists lose there text's and value's and are initialized to the "Select" text.
   1) Is there a flag (or property) I can check that will let me know that the Form is currently being displayed so I can know not to rebind the grid when I hit refresh. 
   2) In my itembound, the refresh comes in as a GridCommandItem, and I cannot seem  to access the GridEditFormItem dropdownlists to refresh them with the text's and value's I need.
     I have tried various cast's but no go. I am trying to figure out how to traverse the MasterTableView to access the Form Template items. is there a more straight forward approach ? Or a combination of cast's and FindControl's that I should be looking at ?
  How can I access the form items when the current cycle is for command items ?
  thanks for any help
  David
IQworks
Top achievements
Rank 1
 answered on 10 Mar 2009
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?