Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
106 views
Hello all,

I use a custom control to enable the user to hide or show columns. The settings are persisted in a user's profile. When loading the profile server side I use the Display property of a column in C# to set it's initial visibility. This works very well.

The horizontol grid size is larger then the available screen size so RadGrid correclty shows a scrollbar.

When a user wants to show a column that was not visible before then RadGrid does not recalculate the new scroll width required to show all columns. Let me make an example.

V=visible column, X=invisible column

The users profile has those initial column visibility settings:
0  1  2   3  4  5  6  7  8
V  V  X  V  X  V  V  V  X

So column 2, 4, 8 are invisible on initial load.

The user now wants to make column 2 visible. Client side I call showColumn with no postback to achieve this. RadGrid correclty makes column 2 visible but now column 7 is out of scroll range for the user. If the user goes to a different page by using the pager then RadGrid recalculates the scroll width and everything works as expected. The API doc does not give any hints on calling a method to recalculate the scroll width.

Is this a bug? Is there a workround to make RadGrid recalculate the scroll width? Do you need any further information?

I try Rad Grid 2010.2.713.35

I use the following resizing settings in ClientSettings->Resizing:
AllowColumnResize: True
AllowRowResize: False
ClipCellContentOnResize: False
EnableRealTimeResize: True
ResizeGridOnColumnResize: True
ShowRowIndicatorColumn: True

Michael


Veli
Telerik team
 answered on 28 Sep 2010
4 answers
152 views
Hello!

I've a RadGrid where the User can manage some data.

In Edit- or Insert-Mode the User should be able to provide some data, the data will be checked against a Webservice and the result should be visible in Edit-Mode so the User can view them and finally Click "Finsh" to save the data and end the Edit-Mode.

My Problem is, that I don't know how to handle the Button-Click, where the data is checked.

In ItemCommand I can handle the Button-Event, but I have no access to the EditForm (as far as I know)

protected void DataRadGridItemCommand(object source, GridCommandEventArgs e)
{
    switch (e.CommandName)
    {
        case "CheckData":
            //Check data
            break;
    }
}

In ItemDataBound I have access to the Edit-Form, butI don't know how to handle the Button-Event.

protected void DataRadGridOnItemDataBound(object sender, GridItemEventArgs e)
{
    if (!(e.Item is GridDataItem)) return;
 
    if (e.Item.IsInEditMode)
    {
        var item = (GridEditableItem) e.Item;
        // Access the EditForm
    }
}

Any suggestions, hints?

Thanks in advance.

Dieter
Daniel
Telerik team
 answered on 28 Sep 2010
2 answers
143 views
Hi,

Is there a way to reset all changes made by the client-side (since the last postback) with a client-side script call. If not can I store the last server state in a custom attribute and restore it. I am using Q1 2010 version with checkboxes and reordering by drag and drop features.

Help is appreciated

Bye 

Morgan
richamo
Top achievements
Rank 2
 answered on 28 Sep 2010
2 answers
630 views
I have requirement to add Image in the RadGrid as Hyperlink

Code-Behind is like this

 Protected Sub radgrid1_ItemDataBound(ByVal source As Object, ByVal e As GridItemEventArgs)

            If (e.Item.ItemType = GridItemType.Item) Then

                Dim HtmlImg As New System.Web.UI.WebControls.Image
                HtmlImg = CType(e.Item.FindControl("ImgMachine"), System.Web.UI.WebControls.Image)

                Dim ProductId As New HiddenField
                ProductId = CType(e.Item.FindControl("hdnOrderNumber"), HiddenField)

                HtmlImg.Attributes.Add("onclick", "javascript:window.open('http://www.myshoppingCart.no/OpenShopPackageTracker.aspx?installationID=21140000023&orderNumber=" & ProductId.Value.ToString() & "'); return false;")


            End If

        End Sub

Please help me with inline code for this
Santodip
Top achievements
Rank 1
 answered on 28 Sep 2010
2 answers
72 views
URL that demonstrates the issue:
http://testbed.dragocactoid.com

I have two issues, I have gotten rid of the border surrounding the root level of the menu (CSS override .rmRootGroup {border: none !important;} )

However, as you mouse over the menu items there are top and bottom borders being displayed. I want those to go away, too.

Secondly, the background color of the non-root menuitems is different than the root menuitems.  I don't really care if the background color stays the same or "highlights", but I want all the menu levels to behave the same.

Does someone know which styles I have to override to accomplish this?

Thanks,
Ken
Yana
Telerik team
 answered on 28 Sep 2010
1 answer
79 views
Hi everybody,

I'm playing around with RadChart and I want to make the chart dynamic.
I use the flowing code:
private static int[] huidigJaar = {135, 115, 79, 51, 5}; // ToDo: Values uit webService
private static int[] vorigeJaar = {110, 135, 47, 46, 15 }; // ToDo: Values uit webService
 
 
        protected override void OnLoad(EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                InitRadChart();
                SetGraphValues();
            }
            RadChart1.Skin = "Pastel";
            base.OnLoad(e);
        }
 
        private void SetGraphValues() // Vullen van de Bars in de Grafiek
        {
            ChartSeries aantalSeries = RadChart1.GetSeries("Huidig Jaar");
            if (aantalSeries != null)
            {
                if (aantalSeries.Items.Count > 0)
                {
                    foreach (ChartSeriesItem seriesItem in aantalSeries.Items)
                    {
                        seriesItem.YValue = huidigJaar[seriesItem.Index];
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        aantalSeries.AddItem(huidigJaar[i]);
                    }
                }
            }
 
 
            ChartSeries aantalVorig = RadChart1.GetSeries("Vorig Jaar"); // Vorige Jaar
            if (aantalVorig != null)
            {
                if (aantalVorig.Items.Count > 0)
                {
                    foreach (ChartSeriesItem seriesItem in aantalVorig.Items)
                    {
                        seriesItem.YValue = vorigeJaar[seriesItem.Index];
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        aantalVorig.AddItem(vorigeJaar[i]);
                    }
                }
            }
        }
 
 
        private void InitRadChart() //Initalisatie van de Graph.. hier ook bepalen hoeveel bars.
        {
            // Titel van chart afhankelijk van wat we gaan tekenen.
            const string TITLETEXT = @"Aanvragen in {0} over de tijds periode {1}";
            RadChart1.ChartTitle.TextBlock.Text = string.Format(TITLETEXT,
                                             RadComboBox2.SelectedItem.Text,
                                             RadComboBox1.SelectedItem.Text);
                      
            RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Verdana", 10);
            RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Color.LightSlateGray;
 
            RadChart1.AutoLayout = true;
            RadChart1.PlotArea.XAxis.AutoScale = false;   // Moet op False anders wordt de label niet getoont.        
            RadChart1.PlotArea.XAxis.AddItem("Aangevraagd");
            RadChart1.PlotArea.XAxis.AddItem("Uitgebracht");
            RadChart1.PlotArea.XAxis.AddItem("Gepasseerd");
            RadChart1.PlotArea.XAxis.AddItem("Vervallen");
            RadChart1.PlotArea.XAxis.AddItem("Pijplijn");
            RadChart1.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;
            RadChart1.Appearance.BarOverlapPercent = 40; // Huidige bar over de vorrige heen leggen           
             RadChart1.Series.Clear(); 
 
            //Bars voor het vorige jaar.. Wordt gevuld bij SetGraphValues
            ChartSeries aantallenVorrig = new ChartSeries("Vorig Jaar", ChartSeriesType.Bar);
            RadChart1.AddChartSeries(aantallenVorrig);
            aantallenVorrig.Appearance.ShowLabels = false;
 
            //Bars voor het huidige jaar.. Wordt gevuld bij SetGraphValues
            ChartSeries aantallenHuidig = new ChartSeries("Huidig Jaar", ChartSeriesType.Bar);
            RadChart1.AddChartSeries(aantallenHuidig);
            aantallenHuidig.Appearance.ShowLabels = true;
            aantallenHuidig.Appearance.TextAppearance.TextProperties.Color = Color.Black;
        }
 
        protected void RadComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if ((RadComboBox1.SelectedItem != null) && (RadComboBox2.SelectedItem != null) )
            {
                InitRadChart();
                SetGraphValues();           
            }
        }
 

When I changed one of the RadCombo Boxes, the Title is updated perfectly but I get the,
extra serries in my chart.  
View screenshot.  

What is it, that I'm douing wrong ?




Erik
Top achievements
Rank 1
 answered on 28 Sep 2010
0 answers
87 views
Hi,

1.
Can I know how configure the related combobox "Country" don't auto open for every times I select "Continent"
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

2.
Can I know why I try add Empty Message for Multi-column Combobox , but didn't show out.
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx


Thanks.

aw
aw
Top achievements
Rank 1
 asked on 28 Sep 2010
1 answer
196 views

Hi,
i am using Radgrid and here is the column ...

 <telerik:GridHyperLinkColumn DataTextField="CostCentre" HeaderText="Cost Centre" SortExpression="CostCentre"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="CostCentre"
                            DataNavigateUrlFields="Id"
                            DataNavigateUrlFormatString="~/Allotment/Allotment.aspx?allotmentId={0}&ViewMode=ReadOnly"
                            Target="_blank"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="80px"
                            />

but when i am trying to access the text of this field i am getting error.

public static void PrintRadGrid(ref StringBuilder content, RadGrid radgrid, ArrayList fieldsList, string gridTitle)
    {

        //print rows
        foreach (GridDataItem item in radgrid.Items)
        {
            ArrayList newArray = new ArrayList();

            for (int i = 0; i < fieldsList.Count; i++)
            {   
                Type type = radgrid.Columns[i].GetType();

                if (type.Name == "GridHyperLinkColumn")
                {
                   newArray.Add(((HyperLink)item[fieldsList[i].ToString()].Controls[i]).Text);
                }
                else if (type.Name == "GridBoundColumn")
                {
                   newArray.Add(item[fieldsList[i].ToString()].Text);
                }
            }

            content.Append("<tr>");
            foreach (string value in newArray)
            {
                content.Append("<td>" + value + "</td>");
            }
            content.Append("</tr>");
        }


        content.Append("</table>");
        content.Append("<br />");

    }

and it is working fine for GridBoundColumn.


please help.
Shinu
Top achievements
Rank 2
 answered on 28 Sep 2010
2 answers
128 views
Hi there,


All Im wanting to do is get the value from the combo box when i do a post back so that I know what item was selected. This isnt in the manual but it must be a failry common task.

Please help.


Cheers,

Trent
trent
Top achievements
Rank 1
 answered on 28 Sep 2010
2 answers
137 views
Hi there, I am encountering a couple of problems using the scheduler and am wondering if anyone can help.
The first one is that I cannot seem to get appointments to show up under their appropriate resources. Without resources, the scheduler displays the appointments fine. Here is the code, see if you can see what I'm doing wrong:

Initializing resources:
ResourceType resType = new ResourceType("Vehicle");
resType.ForeignKeyField = "VehicleID";
tripScheduler.ResourceTypes.Add(resType);
 
Vehicle[] vehicles = Vehicle.GetVehiclesForDate(DateTime.Parse(txtDate.Text));
foreach (Vehicle vehicle in vehicles)
   tripScheduler.Resources.Add(new Resource("Vehicle", vehicle.ID, vehicle.SummaryTextLong));

Initializing appointments:
Trip[] clientTrips_scheduled = Trip.GetTripsForDate(date, true);
DataTable scheduledTripsTable = new DataTable();
scheduledTripsTable.Columns.Add("ID");
scheduledTripsTable.Columns.Add("Title");
scheduledTripsTable.Columns.Add("Start");
scheduledTripsTable.Columns.Add("End");
scheduledTripsTable.Columns.Add("VehicleID");
DataRow row;
 
foreach (Trip trip in clientTrips_scheduled)
{
    row = scheduledTripsTable.NewRow();
    row["ID"] = trip.ID;
    row["Title"] = trip.Summary;
    row["Start"] = trip.Start;
    row["End"] = trip.End;
    row["VehicleID"] = trip.VehicleID;
 
    scheduledTripsTable.Rows.Add(row);
}
 
tripScheduler.DataSource = scheduledTripsTable;
tripScheduler.DataBind();

The scheduler markup (although I am doing all of the work in code-behind, here's the markup so you can see what I'm doing):
<telerik:RadScheduler ID="tripScheduler" runat="server" DataKeyField="ID" DataSubjectField="Title" DataStartField="Start" DataEndField="End" DisplayDeleteConfirmation="true" onappointmentcreated="tripScheduler_AppointmentCreated" CustomAttributeNames="VehicleID">
    <TimelineView UserSelectable="false" />
    <WeekView UserSelectable="false" />
    <MonthView UserSelectable="false" />
    <DayView UserSelectable="false" />
</telerik:RadScheduler>

Now I don't know what I'm doing wrong, I thought the foreign key field of "VehicleID" should allow appointments to be auto-assigned to their appropriate resources based on their "VehicleID" column value? Or do I need to do more than this?

Any help is greatly appreciated, sorry if I've missed something really obvious :)

The other problem is a very simple one - is it possible to assign separate start and end availability times for each resource? ie each Vehicle on my scheduler will have a shift start/end time, and I want this to be reflected on the scheduler.
Ryan
Top achievements
Rank 1
 answered on 28 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?