Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
166 views


Hi,
I'm using the RadGrid and the "AllowColumnHide" feature.  Is there a way to specify that a column is excluded from the hide-column list that appears when right-clicking on the header?  

The problem is that a user could unselect every column.  This would be a disaster if this was paired with saving grid attributes.

see these Telerik demos for an example:

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/headercontextfiltermenu/defaultcs.aspx
sean
Top achievements
Rank 1
 answered on 03 Dec 2010
1 answer
88 views
Hello,

I have a radcombobox with footer and header.
1. How can i paint them let say in a red color?
2. How can i put in it an image?

I noticed that if i use:
<FooterTemplate>
        <div style="background-color:Red">asas</div>
</FooterTemplate>
not all the footer area is painted.

any suggestions?
 
Thank you,
Oren
Kalina
Telerik team
 answered on 03 Dec 2010
1 answer
191 views

Hi

As I was adding more data in the radgrid, it does a postback , however, the items in the radlistbox is duplicated
everytime there is a postbac, attached is the code. To run, click the -> to add data to the right hand side radlistbox,
and add a row to the radgrid, once finished, click the button at the bottom, you can see the items in the radlistbox
is duplicated, sometimes even tripled, please help,this is an urgent issue.

thanks, -regards, Al




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
  
/// <summary>
/// Summary description for Auto
/// </summary>
public class Auto
{
      
        //
        // TODO: Add constructor logic here
        //
         public int VIN { get; set; }
        public string Model { get; set; }
        public string Make { get; set; }
        public int HiddenMileage { get; set; }
  
      
}




using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections.Generic;
  
public partial class Default : System.Web.UI.Page 
{
    public List<Auto> Cars;
    public List<Auto> destCars = new List<Auto>();
  
    protected void Page_Load(object sender, EventArgs e)
    {
  
        if (!IsPostBack)
        {
              
            //Grid
            LoadCars();
  
            //transfer boxes
            this.lbAOBSource.ItemDataBound += new RadListBoxItemEventHandler(lbAOBDestination_ItemDataBound);
            this.lbAOBDestination.Transferring += new RadListBoxTransferringEventHandler(lbAOBSource_Transferring);
            lbAOBDestination.Updating += new RadListBoxUpdatingEventHandler(lbAOBDestination_Updating);
            lbAOBDestination.PreRender += new EventHandler(lbAOBDestination_PreRender);
            lbAOBDestination.Inserting += new RadListBoxInsertingEventHandler(lbAOBDestination_Inserting);
            lbAOBDestination.DataBinding += new EventHandler(lbAOBDestination_DataBinding);
            //lbAOBDestination.
  
            this.lbAOBDestination.RegisterWithScriptManager = false;
  
            this.lbAOBSource.DataValueField = "VIN";
            this.lbAOBSource.DataTextField = "Model";
  
  
            //set the object in session state
            this.Session["Cars"] = Cars;
  
            //set the destination list
        }
        else
        {
            Cars = (List<Auto>)this.Session["Cars"];
        }
        this.lbAOBSource.DataSource = Cars;
        this.lbAOBSource.DataBind();
  
    }
  
    void lbAOBDestination_DataBinding(object sender, EventArgs e)
    {
        //throw new NotImplementedException();
    }
  
    void lbAOBDestination_Inserting(object sender, RadListBoxInsertingEventArgs e)
    {
        //throw new NotImplementedException();
    }
  
    void lbAOBDestination_PreRender(object sender, EventArgs e)
    {
        //throw new NotImplementedException();
    }
  
    void lbAOBDestination_Updating(object sender, RadListBoxUpdatingEventArgs e)
    {
        //throw new NotImplementedException();
    }
  
    void lbAOBSource_Transferring(object sender, RadListBoxTransferringEventArgs e)
    {
        //throw new NotImplementedException();
    }
  
    void lbAOBDestination_ItemDataBound(object sender, RadListBoxItemEventArgs e)
    {
        //throw ne//w NotImplementedException();
    }
  
  
    private void LoadCars()
    {
        Cars = new List<Auto>();
  
        Auto Car = new Auto();
        Car.Make = "Ford";
        Car.Model = "Fiesta";
        Car.HiddenMileage = 100000;
        Car.VIN = 101;
        Cars.Add(Car);
  
        Car = new Auto();
        Car.Make = "Isuzu";
        Car.Model = "Rodeo";
        Car.HiddenMileage = 5000;
        Car.VIN = 102;
        Cars.Add(Car);
  
        Car = new Auto();
        Car.Make = "Honda";
        Car.Model = "Civic";
        Car.HiddenMileage = 200000;
        Car.VIN = 103;
        Cars.Add(Car);
  
        Car = new Auto();
        Car.Make = "chevy";
        Car.Model = "Cobalt";
        Car.HiddenMileage = 100000;
        Car.VIN = 104;
        Cars.Add(Car);
    }
  
    protected void GridCars_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        GridCars.MasterTableView.DataSource = Cars;
        //GridCars.DataSource = Cars;
        //GridCars.DataBind();
    }
  
    protected void GridCars_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        Auto newCar = new Auto();
        GridDataItem gdiItem = (GridDataItem)e.Item.DataItem;
        newCar.VIN = int.Parse(((TextBox)e.Item.FindControl("txtVIN")).Text);
        newCar.Make = ((TextBox)e.Item.FindControl("txtMake")).Text;
        newCar.Model = ((TextBox)e.Item.FindControl("txtModel")).Text;
        newCar.HiddenMileage = int.Parse(((TextBox)e.Item.FindControl("txtMileage")).Text);
        if (Cars == null)
        {
            Cars = new List<Auto>();
            LoadCars();
        }
        Cars.Add(newCar);
        this.Session["Cars"] = Cars;
        //e.ExecuteCommand("Cancel");
    }
  
    protected void GridCars_PreRender(object sender, EventArgs e)
    {
  
        GridCars.MasterTableView.Rebind();
        //GridCars.Rebind();
    }
  
    protected void GridCars_ItemCommand(object source, GridCommandEventArgs e)
    {
  
    }
  
    protected void GridCars_ItemInserted(object source, GridInsertedEventArgs e)
    {
  
    }
  
    protected void GridCars_DeleteCommand(object source, GridCommandEventArgs e)
    {
  
    }
  
    protected void GridCars_EditCommand(object source, GridCommandEventArgs e)
    {
  
    }
  
    protected void GridCars_UpdateCommand(object source, GridCommandEventArgs e)
    {
  
    }
  
  
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "There are " + lbAOBDestination.Items.Count + " items in the destination";
    }
}






<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
      
       <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
      
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
      <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="GridCars">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridCars" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
      
      
      <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        
        <telerik:RadGrid ID="GridCars" runat="server" AutoGenerateEditColumn="True" AutoGenerateDeleteColumn="True"
        AllowAutomaticInserts="False" AllowAutomaticDeletes="False" AllowAutomaticUpdates="False"
        Skin="Office2007" OnNeedDataSource="GridCars_NeedDataSource" OnPreRender="GridCars_PreRender"
        OnInsertCommand="GridCars_InsertCommand" OnItemCommand="GridCars_ItemCommand"
        OnItemInserted="GridCars_ItemInserted" OnDeleteCommand="GridCars_DeleteCommand"
        OnEditCommand="GridCars_EditCommand" OnUpdateCommand="GridCars_UpdateCommand">
        <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" AutoGenerateColumns="True"
            DataKeyNames="VIN">
            <EditFormSettings InsertCaption="Add Auto" CaptionFormatString="Edit VIN: {0}" CaptionDataField="VIN"
                EditFormType="Template" PopUpSettings-Modal="true">
                <FormTemplate>
                    <table id="Table1" cellspacing="1" cellpadding="1" width="250" border="0">
                        <tr>
                            <td>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                VIN:
                            </td>
                            <td>
                                <asp:TextBox ID="txtVin" Text='<%# Bind( "VIN") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Make:
                            </td>
                            <td>
                                <asp:TextBox ID="txtMake" Text='<%# Bind( "Make") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Model:
                            </td>
                            <td>
                                <asp:TextBox ID="txtModel" Text='<%# Bind( "Model") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Mileage:
                            </td>
                            <td>
                                <asp:TextBox ID="txtMileage" Text='<%# Bind( "HiddenMileage") %>' runat="server">
                                </asp:TextBox>
                            </td>
                        </tr>
                    </table>
                    <table style="width: 100%">
                        <tr>
                            <td align="right" colspan="2">
                                <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button
                                <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                </asp:Button>
                            </td>
                        </tr>
                    </table>
                </FormTemplate>
                <PopUpSettings Modal="True"></PopUpSettings>
            </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>
      
      
    <telerik:RadListBox ID="lbAOBSource" runat="server" TransferToID="lbAOBDestination"
        AllowTransfer="True" Height="150" Width="360" Skin="Office2007" AllowTransferOnDoubleClick="true"
        AllowTransferDuplicates="false" SelectionMode="Multiple">
        <ButtonSettings TransferButtons="Common" />
    </telerik:RadListBox>
    <telerik:RadListBox ID="lbAOBDestination" runat="server" Height="150" Width="300"
        AllowTransferDuplicates="false" Skin="Office2007" AllowTransferOnDoubleClick="true"
        SelectionMode="Multiple" />
    <br />
    <asp:Button ID="Button1" runat="server" Text="Click Me" 
        onclick="Button1_Click" />
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    <div>
  
    </div>
    </form>
</body>
</html>
Dimitar Terziev
Telerik team
 answered on 03 Dec 2010
2 answers
77 views
Hey guys

I have a dual listbox for adding items, selecting roles and employees.  When I free an employee, they go into the "available pool".  When I choose from the available pool, it moves to the "assigned" on the right.  Pretty simple.  I have a save button that makes the necessary adjustments to my associative tables. 

What would be neat is to be able to use an icon on items that are "new" or "dirty".  I was thinking I could do this maybe through client script?

Also, is there any way I could iterate through the items collection, and know what is dirty and what is  not?  IE what was placed in a container from an action.  I was maybe thinking of an attribute.  An example would be greatly appreciated.
Dimitar Terziev
Telerik team
 answered on 03 Dec 2010
1 answer
97 views
Hi,
We have requirement, where in we need to create dynamic controls, so need to add controls like buttons,textbox, radCalenderPicker and few other controls, we are facing 2 issues currently,
1. We have a remove button, which should remove set of items, which currently I am adding as Items, so we wanted to know, can we use removeatIndex() and wanted to understand this functionality.
2. And second must bigger issue is, whenever we have a post back, the dynamic controls gets disappears, and we can only see the RadPanelBar, so can you guys let us know the better approach.
3. Can we use Repeaters inside a RadPanelBar?

Below is the code Snippet
// This the code snippet which is used to create dynamic controls

protected
override void OnInit(EventArgs e)
        {
            base.OnInit(e);
//Method gets click event name
            myControl = GetPostBackControl(this.Page);
 
            if ((myControl != null))
            {
                if ((myControl.ClientID.ToString() == btnAddDestination.ClientID.ToString()))// "AddDestinations_btnAddDestination"))
                {
                    stDestinationCnt = stDestinationCnt + 1;
                }
            }
 
            if ((myControl != null))
            {
                if ((myControl.ClientID.ToString() == btnAddDestination.ClientID.ToString()))
                {
 
 //stDestination has custom logic, which is used to add number of controls and also keeps track of previous count
                    for (int i = 0; i < stDestinationCnt; i++)
                    {
 
                        // Litrals first line of table
                        LiteralControl literalHeader = new LiteralControl(@"<table border=""0"" width=""100%""><tr>");
                        newChild.Controls.Add(literalHeader);
Label lbldest = new Label();
                        lbldest.ID = "lbldestination" + stDestinationCnt.ToString();
                        lbldest.Text = "Destination:";
                        newChild.Controls.Add(lbldest);
 
                        //Textbox for destination ID
                        LiteralControl literalDestinationIDTxt = new LiteralControl(@"</td><td width=""100px"">");
                        newChild.Controls.Add(literalDestinationIDTxt);
                        TextBox txtdestination = new TextBox();
                        txtdestination.Text = "Destination";
                        txtdestination.ID = "txtDestination" + stDestinationCnt.ToString();
                        newChild.Controls.Add(txtdestination);
  LiteralControl literalRemove = new LiteralControl(@"</td><td rowspan=""4"">");
                        Button btn = new Button();
                        btn.ID = "Remove" + stDestinationCnt.ToString();
                        btn.Text = "Remove";
                        newChild.Controls.Add(btn);
newChild.Visible = true;
 
                        //Add Controls to Panel Bar
                        RadPanDestination.Items.Add(newChild);
}

//ascx design
    <tr><td>
    <telerik:RadPanelBar runat="server" ID="RadPanDestination" Text="Test" ExpandMode="SingleExpandedItem"
        Width="100%" >
        <Items>
            <telerik:RadPanelItem Text="Destinations" Width="100%">
                <ItemTemplate>


                </ItemTemplate>
            </telerik:RadPanelItem>
        </Items>
    </telerik:RadPanelBar>
    </td></tr>
 we are having this code in user control
Yana
Telerik team
 answered on 03 Dec 2010
5 answers
126 views

Hi Guys,

I'm trying to use the RadScheduler in an MVC app, and have been through the various sample apps etc. top check it out.
Its *almost* working in that its loading up and not producing any errors.

However, there are no styles, and it seems no scripts either. I checked in the source and while in the sample apps I have several "webresources" calls being loaded into the head tag, in my app these are not appearing.

I am using the telerik script and stylesheet manager (for MVC) so I wonder if this is affecting it..?
Worst case I could manually load the styles and scripts, but that seems to pose its own problems at the moment, since they're dynamically loaded.

Any help would be very gratefully received as I'm going round in circles at the moment!

Thanks,
Ben
Peter
Telerik team
 answered on 03 Dec 2010
4 answers
210 views
Dim insertQuantity As String
Dim insertEquipment As String
Dim intNumber As Integer = 1
Dim newControl As New Control
For intNumber = 1 To 1
    insertQuantity = "txtQuantity" + CStr(intNumber)
    insertEquipment = "txtEquipment" + CStr(intNumber)
    newControl = DirectCast(Me.FindControl(insertQuantity), TextBox)
    If (Not newControl Is Nothing) Then
        Response.Write("Cant find control ")
    Else
        Response.Write("Found the control")
        newControl = DirectCast(Me.FindControl(insertQuantity), TextBox)
    End If
Next intNumber
Hello There,

i am trying to retrieve values from multiple text boxes.  i Created the textboxes(quantity1, quantity2, etc)
and i am trying to pull these values when a user clicks the button.  This is what i have so far.

Please help.  When i access newControl.Text it is giving me a null reference to an instance of an object. Thank  you.

 

Birju
Top achievements
Rank 1
 answered on 03 Dec 2010
2 answers
98 views
Hi there

I am putting together an upload page using the following as a guide....

http://demos.telerik.com/aspnet-ajax/upload/examples/async/webmail/defaultcs.aspx?product=asyncupload

At the moment just testing so used the example above as a guideline.

Everything works - file gets uploaded and the submit is disabled during upload and then re-enabled and does what i want it too after the file has been uploaded.

Only problem is after the submit button is pressed we get an error pop up saying "Error: '$telerik' is undefined"

If we close the error message everything continues to work but I cannot understand why this error gets raised as everything appears to work - file is uploaded et...

I have tried to debug but all web resources are located correctly and there are no other errors.

Any ideas?

Geoff
Top achievements
Rank 1
 answered on 03 Dec 2010
1 answer
86 views
Hi,
it's been all day I have been trying to figure out why the radeditor I placed inside a usercontrol stopped working.
This is the deal: I have a RadPanel which contains some Textbow and a Radeditor. It used to work until today. Now I can only save  the editor's content using other browser than IE.
Can someone help me figure out what happened?
Thanks!
Rumen
Telerik team
 answered on 03 Dec 2010
1 answer
70 views
Hi all,

Relatively simple question to check my understand of what is/is not possible.

I have one DockZone with two Docks inside of it. Each of these docks is hosting an interactive chart.
I would like to AJAXify both of these, but have the updated controls be limited to the Dock which initiated the AJAX request.

I read that using RadAjaxManager to do this is not recommended. Indeed, when I set up a RadAjaxManager such that it attempted to update individual docks (as opposed to waiting for an AJAX request from the DockZone and then updating the DockZone) I receive the error: Telerik.Web.UI.RadDockZone can contain only controls of type Telerik.Web.UI.RadDock. I believe that this is occurring because of the 'imaginary' update panel which is being wrapped around the respective dock.

I read that the more accepted means of doing this is to use the standard UpdatePanel. I attempted to do so using the following snippit of HTML;

<telerik:RadDock ID="RadDock3" Runat="server" DockMode="Docked" Skin="Web20" Width="33.3%">
    <ContentTemplate>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <uc1:PowerUsage ID="PowerUsage1" runat="server" />
            </ContentTemplate>
        </asp:UpdatePanel>
    <ContentTemplate>
 </telerik:RadDock>

In addition, I moved the UpdatePanel outside of RadDock3 so that it wrapped the entire RadDock. Neither of these options proved fruitful, though. I continue to receive the above error message.

What am I doing wrong here? Is it not possible to update individual docks within a DockZone? 
Pero
Telerik team
 answered on 03 Dec 2010
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?