Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
90 views
Hi All,
          I have a radgrid with approx 15 columns. I have a requiremnt like .. Logged in user should be able to select the columns which he wants to see from the 15 available colomns and save the grid settings, and when he next time logs in he will see those columns which he saved in settings instead of all 15 columns. How can i achieve this using GridSettingsPersister class.Please help me regarding this.

Regards,
Dheeraj

Dheeraj
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
169 views

 

protected void btnSearch_Click(object sender, EventArgs e)

 

{

 

getChart();

 

}

 

 

protected void getChart()

 

{

 

 

DateTime today = RadDatePicker1.SelectedDate.Value;

 

 

DateTime _lastDate = RadDatePicker2.SelectedDate.Value;

 

 

// Setup chart orientation

 

 

this.radChart1.SeriesOrientation = ChartSeriesOrientation.Vertical;

 

 

// Setup XAxis

 

 

this.radChart1.PlotArea.XAxis.IsZeroBased = false;

 

 

this.radChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;

 

 

this.radChart1.PlotArea.XAxis.AutoScale = false;

 

 

this.radChart1.PlotArea.XAxis.AddRange(today.ToOADate(), _lastDate.ToOADate(), 7);

 

 

this.radChart1.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Inside;

 

 

 

// Setup YAxis

 

 

this.radChart1.PlotArea.YAxis.IsZeroBased = false;

 

 

this.radChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.Percent;

 

 

this.radChart1.PlotArea.YAxis.AutoScale = false;

 

 

this.radChart1.PlotArea.YAxis.AddRange(0, 1, 0.1);

 

 

 

// Setup Series

 

 

this.radChart1.Series[0].Type = ChartSeriesType.Line;

 

 

this.radChart1.Series[0].DataXColumn = "X";

 

 

this.radChart1.Series[0].DataYColumn = "Y";
this.radChart1.Series[0].Appearance.LabelAppearance.Visible = false;

 

 

 

this.radChart1.DataSource = GenerateSource("Table");

 

 

this.radChart1.DataMember = "Table";

 

 

this.radChart1.DataBind();

 

 

}

 

 

 

private DataSet GenerateSource(string tableName)

 

{

 

DateTime startDate = Convert.ToDateTime(RadDatePicker1.SelectedDate.Value);

 

 

DateTime NewStartDate = Convert.ToDateTime(Projects.GetStartDayOfWeek(startDate));

 

 

DateTime EndDate = Convert.ToDateTime(RadDatePicker2.SelectedDate.Value);

 

 

 

DataTable _oData = new DataTable();

 

 

DateTime _sdate = startDate;

 

 

for (DateTime i = startDate; i <= EndDate; i.AddDays(7))

 

{

 

string[] SplitAction = i.ToString().Split(new Char[] { '/' });

 

 

string columnName = SplitAction[0] + "/" + SplitAction[1];

 

 

 

DataColumn oDataColoumn = new DataColumn(Convert.ToString(columnName), System.Type.GetType("System.String"));

 

i = i.AddDays(7);

_oData.Columns.Add(oDataColoumn);

 

}

 

DataTable table = new DataTable(tableName);

 

table.Columns.Add(

"X", typeof(double));

 

table.Columns.Add(

"Y", typeof(double));

 

 

DataTable oDataTable = Platforms.GetAllPlatforms();

 

 

DataRow dr1 = oDataTable.NewRow();

 

dr1[

"PlatformName"] = "Multiple";

 

dr1[

"PlatformID"] = 0;

 

oDataTable.Rows.Add(dr1);

 

DataRow dr = _oData.NewRow();

 

 

 

 

double total = 0;

 

NewStartDate =

Convert.ToDateTime(Projects.GetStartDayOfWeek(startDate));

 

 

 

for (int oCount = 0; oCount <= _oData.Columns.Count - 1; oCount++)

 

{

 

 

string i = _oData.Columns[oCount].ToString();

 

 

string[] SplitAction = i.ToString().Split(new Char[] { '/' });

 

 

string columnName = SplitAction[0] + "/" + SplitAction[1] + "/" + "2010";

 

 

DateTime dt = Convert.ToDateTime(columnName);

 

 

string ss = GetCountForQuotesTimelines(NewStartDate, Convert.ToInt64(oDataTable.Rows[1][0].ToString()));

 

 

string[] SplitAction1 = ss.ToString().Split(new Char[] { '%' });

 

 

string columnName1 = SplitAction1[0];

 

 

 

 

if (ss != null)

 

{

 

DataRow dr2 = table.NewRow();

 

dr2[

"X"] = dt.ToOADate();

 

 

if (columnName1 == "")

 

{

dr2[

"Y"] = 0;

 

}

 

else

 

{

dr2[

"Y"] = Convert.ToDouble(columnName1);

 

}

 

table.Rows.Add(dr2);

}

 

else

 

{

 

 

}

NewStartDate = NewStartDate.AddDays(7);

}

 

 

 

 

 

DataSet dataSet = new DataSet();

 

dataSet.Tables.Add(table);

 

return dataSet;

 

}

}


///---------------------------

hello ,

I have created a radchart series items dynamically according to the date range selected.My logic show me the proper dataset in the datasource returned but it's not attach with radchart databind event .and don't show any error.all the fields are generated at runtime.
please see the attach file i.e screen shot what i want to do.
Please help me to get out of this error as soon as possible.

Thanks in advance..
 

Ves
Telerik team
 answered on 27 May 2010
1 answer
102 views
HI, i have an issue whit one grid populate whit datasource populate from webservice(svc).

I create a simple webservice where i put some rows.
I create a method for paging that data in each class where i want to have the paging, i pass the parameter
- grid.currentIndex
- grid.pagesize
- filter
- sort

Now, i create a new application where i insert the webservice and create a page where i insert the radgrid whit my parameter and allowpaging set on true.

in the code i use the method for populate that grid and that return all of my row and it populate but paging never won't show.

in the project of the webservice a try the method if having am error and i create inside the radgrid but whitout call the webservice but using EntityDataSource and the grid run perfectly whit paging.

where i make an error??
thanks
Johny
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
111 views
Hi Telerik team,

I have placed multiple user controls inside a Dock zone. Controls loaded fine. Each user control contains multiple controls. I want to access the control values for saving reports.

Example: Rad Dock contains two user controls A, B.
A has two combo boxes and a textbox
B has two radio buttons and a text box.
I need to access the control values inside the user control from the Rad dock .

Please let me know, whether its possible or not.

Thanks,
Nag
Pero
Telerik team
 answered on 27 May 2010
1 answer
75 views
Hi

I downloaded the samples from the following URL. While sorting and applying the filter, it is not retaining the appropriate seletion.

http://www.telerik.com/community/code-library/aspnet-ajax/grid/client-side-row-selection-persisted-with-paging.aspx
http://www.telerik.com/ClientsFiles/131957_pagingwithclientsideselecting-web-ui.zip
Martin
Telerik team
 answered on 27 May 2010
3 answers
947 views
Hi
I want to call Codebehind function from javascript with parameters, then update the radajax panel
e.g
CodeBehind
public function CallCodeBehind(byval InValue as string) as boolean
        code......    
end function

Javascript
    function FromJavascript(){
    var InValue='1';        
    <    What to do here?    >

    }

Now what should i write in <what to do here > code to execute codebehind function with parameters and then update the radajax panel to display new values.


Kind Regards:
Hariindarr Siingh
McConnell Dowell
Shinu
Top achievements
Rank 2
 answered on 27 May 2010
4 answers
290 views
hi all,
   I am using editform to edit my data in radgridview. EditFormType is 'Autogenerated'. I have one problem in insert mode.
I have one status column in the grid. This is not a visible column and i need to show this column in edit mode only. In normal mode and insert mode i need not siplay this control. I specify the template column in grid view as follows

<telerik:GridTemplateColumn UniqueName="Status" HeaderText="Status" Visible="false" > 
    <EditItemTemplate> 
         <asp:CheckBox ID="chk1" runat="server" /> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 

In my databound event i try to set visibility of this column. checkbox will hide in the insert mode but the header text exists the same. how to handle that header text also. my code behind is

    Protected Sub Rad_grd1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles Rad_grd1.ItemDataBound  
 
        If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then  
            Dim edititem As GridEditFormItem = CType(e.Item, GridEditableItem)  
            If edititem.OwnerTableView.IsItemInserted Then  
                edititem("Status").Visible = False 
            Else  
                edititem("Status").Visible = True 
            End If  
        End If  
 
    End Sub  
 
Only checkbox is hide. please help to handle that header text. If i didnt put header text in design mode, ':' is visible. how to handle this colon (:) in the editmode
Akhil Raj
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
337 views

My grid is databound to List<Entity>

Edit mode is:

 EditMode="PopUp" 

EditForm is template:

<EditFormSettings EditFormType="Template" ... />

I want to customize pop-up caption that it will say 'You are editing item {number}'.

I cannot use CaptionFormatString because {number} is not my Entity property. It is just subsequent number and it can be DataItem.ItemIndex as well.

I may set it declaratively or in code-behind but how to extract DataItem.ItemIndex of editing row?

Shinu
Top achievements
Rank 2
 answered on 27 May 2010
4 answers
234 views
This is my ascx code

<td  colspan="2" style="height:auto">
                    <telerik:RadGrid ID="gv_data_contract" runat="server" AutoGenerateColumns="False" GridLines="None" OnNeedDataSource="gv_data_contract_NeedDataSource" Width="1034px" AllowPaging="True" Skin="Web20" OnItemCommand="gv_data_contract_ItemCommand" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" OnItemDataBound="gv_data_Contract_ItemDataBound">
                        <MasterTableView CommandItemDisplay="Top" DataKeyNames="ContractID" NoMasterRecordsText="No hay Contratos para mostrar." EditMode="PopUp">
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelText="Cancelar" EditText="Editar"
                                    InsertText="Adicionar" UpdateText="Actualizar">
                                    <HeaderStyle Font-Names="Arial" Font-Size="12px" Width="15px" />
                                    <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                        Font-Underline="False" HorizontalAlign="Center" Wrap="True" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn DataField="ContractCode" UniqueName="ContractCode" HeaderText="C&#243;digo">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ReferenceID" HeaderText="Referencia" UniqueName="ReferenceID">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn DataField="PersonConpanyName" HeaderText="Contratante" UniqueName="PersonConpanyName">
                                    <ItemTemplate>
                                    
                                        <asp:Label ID="lbl_gv_companyName" runat="server" ></asp:Label>
                                           <asp:Label id="lbl_gv_data_PersonCompanyName" runat="server">
                                              <%# DataBinder.Eval(Container.DataItem, "Person.PersonCompanyName") %>
                                           </asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="StartingDate" DataFormatString="{0:d}" DataType="System.DateTime"
                                    HeaderText="Fecha Inicia" UniqueName="StartingDate">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="EndingDate" DataFormatString="{0:d}" DataType="System.DateTime"
                                    HeaderText="Fecha Termina" UniqueName="EndingDate">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="TotalAmount" DataFormatString="{0:c2}" DataType="System.Decimal"
                                    HeaderText="Valor Total" UniqueName="TotalAmount">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridCheckBoxColumn DataField="ContractStatus" DataType="System.Boolean"
                                    HeaderText="Estado" UniqueName="ContractStatus">
                                    <HeaderStyle Font-Bold="True" Font-Names="Verdana" Font-Size="13px" HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" />
                                </telerik:GridCheckBoxColumn>
                            </Columns>
                            <EditFormSettings EditFormType="Template">
                                <EditColumn UniqueName="EditCommandColumn1">
                                </EditColumn>
                                <FormTemplate>
                                    <table style="padding-left: 8px; font-family: Arial; font-size: 12pt; width: 98%;">
                                        <tr>
                                            <td style="width: 187px">
                                            </td>
                                            <td style="width: 275px">
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Seleccione Cliente</td>
                                            <td style="width: 275px">
                                                <asp:DropDownList ID="ddl_gv_person" runat="server" DataTextField="Person.PersonCompanyName" DataValueField="PersonID" >
                                                </asp:DropDownList>
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Referencia Contrato</td>
                                            <td style="width: 275px">
                                                <telerik:RadTextBox ID="txb_rd_ReferenceID" runat="server" EmptyMessage="--- Introduzca Referencia ---"
                                                    Skin="WebBlue" Width="177px" Text='<%# Bind("ReferenceID") %>'>
                                                    <EnabledStyle HorizontalAlign="Right" />
                                                    <DisabledStyle HorizontalAlign="Right" />
                                                    <EmptyMessageStyle ForeColor="Blue" HorizontalAlign="Center" />
                                                </telerik:RadTextBox></td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Fecha Inicia</td>
                                            <td style="width: 275px">
                                                <telerik:RadDatePicker ID="txb_rdp_StartingDate" runat="server" Skin="WebBlue" Width="175px" Culture="English (United States)" DbSelectedDate='<%# Bind("StartingDate") %>'>
                                                    <Calendar runat="server" Skin="WebBlue" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                        ViewSelectorText="x">
                                                        <FastNavigationSettings CancelButtonCaption="Cancelar" DateIsOutOfRangeMessage="Fecha fuera de rango.">
                                                        </FastNavigationSettings>
                                                        <DisabledDayStyle HorizontalAlign="Right" />
                                                        <SelectedDayStyle HorizontalAlign="Right" />
                                                    </Calendar>
                                                    <DatePopupButton HoverImageUrl="" ImageUrl="" ToolTip="Mostrar Calendario." />
                                                    <DateInput runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" EmptyMessage="--- Seleccione Fecha Inicial ---">
                                                        <EmptyMessageStyle ForeColor="Blue" HorizontalAlign="Center" />
                                                        <EnabledStyle HorizontalAlign="Right" />
                                                    </DateInput>
                                                </telerik:RadDatePicker>
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Fecha Termina</td>
                                            <td style="width: 275px">
                                                <telerik:RadDatePicker ID="txb_rdp_EndingDate" runat="server" Skin="WebBlue" Width="175px" Culture="English (United States)" DbSelectedDate='<%# Bind("EndingDate") %>'>
                                                    <Calendar runat="server" Skin="WebBlue" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                                        ViewSelectorText="x">
                                                        <FastNavigationSettings CancelButtonCaption="Cancelar" DateIsOutOfRangeMessage="Fecha fuera de rango.">
                                                        </FastNavigationSettings>
                                                        <DisabledDayStyle HorizontalAlign="Right" />
                                                        <SelectedDayStyle HorizontalAlign="Right" />
                                                    </Calendar>
                                                    <DatePopupButton HoverImageUrl="" ImageUrl="" ToolTip="Mostrar Calendario." />
                                                    <DateInput runat="server" DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" EmptyMessage="--- Seleccione Fecha Final ---">
                                                        <EmptyMessageStyle ForeColor="Blue" HorizontalAlign="Center" />
                                                        <EnabledStyle HorizontalAlign="Right" />
                                                    </DateInput>
                                                </telerik:RadDatePicker>
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Valor Total</td>
                                            <td style="width: 275px">
                                                <telerik:RadNumericTextBox ID="txb_rn_TotalAmount" runat="server" Culture="English (United States)"
                                                    DataType="System.Decimal" Skin="WebBlue" Type="Currency" Value="0" Width="186px" DbValue='<%# Bind("TotalAmount") %>'>
                                                    <DisabledStyle HorizontalAlign="Right" />
                                                    <IncrementSettings InterceptArrowKeys="False" InterceptMouseWheel="False" />
                                                    <EmptyMessageStyle ForeColor="Blue" HorizontalAlign="Center" />
                                                    <EnabledStyle HorizontalAlign="Right" />
                                                </telerik:RadNumericTextBox></td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                                Estado Contrato</td>
                                            <td style="width: 275px">
                                                </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px">
                                            </td>
                                            <td style="width: 275px">
                                            </td>
                                            <td>
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 187px; height: 26px">
                                            </td>
                                            <td align="right" style="width: 275px; height: 26px">
                                                <asp:Button ID="btnUpdate" Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Adicionar" : "Actualizar" %>'
                                                    runat="server" CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>'>
                                                </asp:Button>&nbsp;
                                                <asp:Button ID="btnCancel" Text="Cancelar" runat="server" CausesValidation="False"
                                                CommandName="Cancel"></asp:Button>
                                            </td>
                                            <td style="height: 26px">
                                            </td>
                                            <td style="height: 26px">
                                            </td>
                                        </tr>
                                    </table>
                                </FormTemplate>


My problem is that I don't know how to bind a DDL in code behind in order to Insert or Edit

I have this codebehind:

protected void gv_data_Contract_ItemDataBound(object sender, GridItemEventArgs e)
    {

        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = e.Item as GridEditableItem;
            // access/modify the edit item template settings here
            DropDownList list = item.FindControl("lbl_gv_data_PersonCompanyName") as DropDownList;
            list.DataSource = GetCompany();
            list.DataBind();

            if (Session["Updated"] != null)
            {
                list.SelectedValue = Session["updatedValue"].ToString();
            }
        }
        else if (e.Item is GridDataItem && !e.Item.IsInEditMode && Page.IsPostBack)
        {
            GridDataItem item = e.Item as GridDataItem;
            Label label = item.FindControl("ddl_gv_person") as Label;
            // update the label value
            if (label != null) label.Text = Session["updatedValue"];
        }

    }

And I get this error

System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."
 



Bricton Perez
Top achievements
Rank 1
 answered on 27 May 2010
0 answers
76 views
A script that mistake can be solved?
w j
Top achievements
Rank 1
 asked on 27 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
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
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?