Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
253 views
My problem is how do I connect  the TextBox within the RadListView whit the connection that I created so that they could display data from the table. I know that I use ... but then I do not know how ... someone can help me? I attach the key file with one of my experiments!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.Adapters;
using Oracle.DataAccess.Client;
using Telerik.OpenAccess.Config.Sql;
using System.Data;
using Telerik.Web.UI;

namespace WebApplication1
{
    //ccc i due pezzi commentati in questo caso non servono



    public partial class WebForm1 : System.Web.UI.Page
    {
        private OracleConnection conn = new OracleConnection(); //ccc creo una nuova istanza OracleConnection
        private OracleCommand cmd;  //ccc creo una nuova istanza OracleCommand
        private OracleDataReader dr;
        private OracleDataAdapter da;
        private OracleCommandBuilder cb;
        private DataSet ds;

        string sql = " select tasso_iva, max(data_inizio), data_fine from tassi_iva";   //dichiaro una variabile e le associo la query
        //+ "where data_inizio = to_date('01.01.01', 'DD.MM.YY')";

        
        protected void Page_Load(object sender, EventArgs e)
        {
            string ConnString = "data source=OG_DB2;password=ghid101;user id=OG_GHIDONI";

            conn.ConnectionString = ConnString; //ccc associo la connection string con un connection object

            

            try
            {
                conn.Open();    //ccc apro la connessione                                   

                
                OracleCommand cmd = new OracleCommand(sql, conn); // ccc creo un oggetto di tipo Oracle Command

                cmd.CommandType = CommandType.Text;

                /*da = new OracleDataAdapter(cmd);
                cb = new OracleCommandBuilder(da);
                ds = new DataSet();

                da.Fill(ds);*/

                //RgIva.DataSource = ds.Tables[0];

                OracleDataReader dr = cmd.ExecuteReader();  // ccc creo un oggetto ORacleDataReader e gli associo il metodo ripreso dalla
                                                            //ccc classe OracleCommand

                while (dr.Read())
                {

                    /*tb_iva.Text = dr["tasso_iva"].ToString();
                    rdp_inizio.SelectedDate = Convert.ToDateTime(dr["data_inizio"]);
                    rdp_fine.SelectedDate = Convert.ToDateTime(dr["data_fine"]);*/
                }


            }

            catch (Exception ex) // ccc catches any error
            {
                MessageBox.Show(ex.Message.ToString());
            }

            conn.Close();
        }

        protected void RadListView1_ItemCreated(object sender, RadListViewItemEventArgs e)
        {

            if (e.Item is RadListViewDataItem)
            {
                TextBox tb_iva = e.Item.FindControl("TbIVA") as TextBox;
                RadDatePicker rdp_inizio = e.Item.FindControl("RdpInizio") as RadDatePicker;
                RadDatePicker rdp_fine = e.Item.FindControl("RdpFine") as RadDatePicker;

                tb_iva.Text = dr["tasso_iva"].ToString();
                rdp_inizio.SelectedDate = Convert.ToDateTime(dr["data_inizio"]);
                rdp_fine.SelectedDate = Convert.ToDateTime(dr["data_fine"]);

            }
        }

        private OracleDataReader ReadRecords(string query)
        {
            conn.Open();    //ccc apro la connessione                                   

            OracleCommand cmd = new OracleCommand(sql, conn); // ccc creo un oggetto di tipo Oracle Command

            cmd.CommandType = CommandType.Text;

            OracleDataReader dr = cmd.ExecuteReader();

            return dr;
        }

        protected void RadListView1_NeedDataSource(object source, Telerik.Web.UI.RadListViewNeedDataSourceEventArgs e)
        {
            RadListView1.DataSource = ReadRecords(sql);
        }

        protected void RadListView1_DataBound(object sender, System.EventArgs e)
        {
            dr.Close();
        }

    }
}
Thanks a lot
Clo
clo
Top achievements
Rank 1
 answered on 02 Sep 2011
1 answer
158 views
Hi,

This is the first time that i used Telerik Rad Controls, so i'm quite confused with some features.

What i want to do is :
I have 3 asp:TextBox, let's say, tbUserName, tbPostalCode and tbEmail.

And i would like to do a validation through 2 web services :
CheckUserNameExist(string email, string userName) and CheckUserRight(string email, string postalCode, string userName)

Actually i want to do it onBlur event, and call the web service only if the textboxes have values. I mean if the user enter email and username, it will call the first web service and if the user enter all the values in textboxes, then it will call the second web service.

I'm quite confuse on how i can achieve it ?

How can i pass the required parameters (email, username and postalcode) to my web service ? Must i do it through javascript ?

I'm thinking about this code.

<telerik:RadInputManager ID="radManager" runat="server">
        <telerik:TextBoxSetting Validation-IsRequired="true" Validation-Location="UserService.asmx"
            Validation-Method="CheckUserNameExist" Validation-ValidateOnEvent="Blur"
            BehaviorID="tbBehavior1"
        >
            <TargetControls>
                <telerik:TargetInput ControlID="tbEmail" />
                <telerik:TargetInput ControlID="tbUserName" />               
            </TargetControls>
        </telerik:TextBoxSetting>
       <telerik:TextBoxSetting Validation-IsRequired="true" Validation-Location="UserService.asmx"
            Validation-Method="CheckUserRight" Validation-ValidateOnEvent="Blur"
            BehaviorID="tbBehavior2"
        >
            <TargetControls>
                <telerik:TargetInput ControlID="tbEmail" />
                <telerik:TargetInput ControlID="tbUserName" />               
                <telerik:TargetInput ControlID="tbPostalCode" />               
            </TargetControls>
        </telerik:TextBoxSetting>
    </telerik:RadInputManager>
 
<asp:TextBox ID="tbEmail" runat="server"></asp:TextBox>
<asp:TextBox ID="tbUserName" runat="server"></asp:TextBox>
<asp:TextBox ID="tbPostalCode" runat="server"></asp:TextBox>

Thanks in advance, i hope you can help me out with this.

Regards,
Al
Vasil
Telerik team
 answered on 02 Sep 2011
1 answer
96 views
Hello,

In my RadGrid all my items are always in edit mode; I use gridtemplatecolumn with radtextbox for editing. I want to get values of whole columns and sum it up, to show user new sum of the column in label outside radgrid, after any cell is changed - i use onblur function. I ve tried to use dataItem.getDataKeyValue("column_name") but it returns original values, not the ones after edit. Any suggestions on how can i do it in javascript?
Marin
Telerik team
 answered on 02 Sep 2011
1 answer
63 views
Hi there,

This does not work in IE7, IE8, but does in Firefox.

var dock = $find("<%= RadDock1.ClientID %>");

dock is null.

Any ideas?
Princy
Top achievements
Rank 2
 answered on 02 Sep 2011
2 answers
116 views
Hi,

I'm having a problem with the paging buttons. The initial buttons 1-10 works just fine, but when I go to "..." (landing at 11), all the buttons will update their text, but will still be bound to the same events as their previous button IDs had, meaning that if I press 17, I end up back on back 8.

I've searched your forums for similar issues and found http://www.telerik.com/community/forums/aspnet-ajax/grid/355586-radgrid-paging-problem.aspx however this did not help me on the way to a solution.

In order to do some error searching, I've dumbed down an example as much as possible, leaving me with :

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SimpleView.ascx.cs" Inherits="AccessToWeb.Web.SimpleView" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<telerik:RadScriptManager ID="RadScriptManager" runat="server"></telerik:RadScriptManager>
<!-- content start -->
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<div style="padding-left:20px;">
    <telerik:RadGrid ID="RadGrid1" AllowPaging="True" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="None" EnableViewState="true">
      <MasterTableView EnableViewState="true" />
      <PagerStyle Mode="NumericPages" />
    </telerik:RadGrid>
</div>

And codebehind:

namespace AccessToWeb.Web
{
    public partial class SimpleView : System.Web.UI.UserControl
    {
        private string _con, _query;
 
        protected void Page_Load(object sender, EventArgs e)
        {
            _con = Sitecore.Context.Item["Connectionstring"];
            _query = Sitecore.Context.Item["Select statement"];
 
            if (string.IsNullOrEmpty(_con) || string.IsNullOrEmpty(_query))
            {
                this.Visible = false;
                return;
            }
        }
 
        public DataTable GetDataTable(string query)
        {
            SqlConnection conn = new SqlConnection(_con);
            SqlDataAdapter adapter = new SqlDataAdapter();
            adapter.SelectCommand = new SqlCommand(query, conn);
 
            DataTable myDataTable = new DataTable();
 
            conn.Open();
            try
            {
                adapter.Fill(myDataTable);
            }
            finally
            {
                conn.Close();
            }
 
            return myDataTable;
        }
 
        protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = GetDataTable(_query);
        }
    }
}


If I instead of NumericPages use NextPrevAndNumeric, the same problem exists, but the Next button will always point at page 2, no matter which page I am on.
Marin
Telerik team
 answered on 02 Sep 2011
1 answer
369 views
Hi,

   Iam using treeview when we click the node in the treeview based on the node value it will display the data in the radgrid. In the below code we are using list to bind the data.In the list we are getting the data but when we bind it is not displaying any data.Can you please do the needful.

 List<LegacyResource> result = null;

protected void rdCategory_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        try
        {

            if (e.Node != null)
            {
                

                if (int.TryParse(e.Node.Value, out ResourceID))
                {
                    result = LegacyResourceAgent.GetResourceLinks(LinkResourceData, ResourceID);
                    //result.
                    if (result != null)                   
                   this.ManageTootipsGrid.Rebind();
                }
                else
                {
                    this.ManageTootipsGrid.DataSource = result;
                    this.ManageTootipsGrid.DataBind();
                }

            }
        }
        catch (Exception ex)
        {

        }

    }


 protected void manageTooltips_onNeedDataSource(object source, GridNeedDataSourceEventArgs e)
    {
        //refresh data for grid (needed when user performs update, sort, etc...
        this.ManageTootipsGrid.DataSource = result;

    }
Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Sep 2011
8 answers
337 views
Hello.

I am trying to sort a RadGrid by GridHyperLinkColumn . I enabled the sorting and created sorting expression.

I want to make the header clickable in order to change it from ascending/descending  order .
however I cant make the header of the GridHyperLinkColumn clickable  . Can somebody offer me a solution? It does work on theGridBoundColumn  when I enable sorting .

Also after sorting ,the style of the header is changed  . Is there any way to stop it ?

Thank you

Joe 

Joseph
Top achievements
Rank 1
 answered on 02 Sep 2011
1 answer
145 views
When i minimize my window in a tabstrip like your demo and I click on tab to show window like this, The content of my window is reloaded and i lost all my change before minimize. If i look in source of my page, i see change i've made but restore cause a reload. Why ?

 

 

function ShowWindow(win) {

 

 

 

 

if (!win.isVisible()) {

 

 

win.show();

 

win.restore();

 

 

 

//if the window was maximized before client minimizes it, we need to restore

 

 

 

//its maximized state

 

 

 

if (win._Maximized) {

 

 

win.maximize();

 

win._Maximized =

 

null;

 

 

}

 

}

 

 

 

//ensure that the currently active RadWindow will have the highest z-Index.

 

 

 

var popupElem = win.get_popupElement();

 

 

 

 

var oldZindex = parseInt(popupElem.style.zIndex);

 

 

 

 

var styleZIndex = win.get_stylezindex();

 

 

 

 

var newZIndex = (styleZIndex) ? styleZIndex : Telerik.Web.UI.RadWindowUtils.get_newZindex(oldZindex);

 

 

popupElem.style.zIndex =

 

"" + newZIndex;

 

 

win.setActive(

 

true);

 

 

}

Collin
Top achievements
Rank 1
 answered on 01 Sep 2011
1 answer
371 views
I understand that this is supposed to be JQuery code, and the following calls in many of your clientside ajax samples:

 

 

alert( $get("<%= telerikAjaxCtrlID.ClientID %>"));

give you "object"

and

alert( $find("<%= telerikAjaxCtrlID.ClientID %>"));

give you "object object"

and that you can apply JQuery operations against the objects the statements return.  And, I have read some Telerik documentation that refers me to http://api.jquery.com to get a list of what JQuery methods and properties are available because Telerik uses the original JQuery library that has been modified in a minor way with some appended code while preserving the original. 

But, the api.jquery.com documentation describes functions such as $.get and $.find (NOT $get and $find), and none of the JQuery methods and properties that can be applied to $.get and $.find seem to work against what is returned by $find and $get.  For example, the JQuery $.get function is used to retrieve javascript from the server - not to locate any controls on a page.  I can't see how anyone could expect methods and properties that come from $.get to be able to work with $get which you seem to use to locate controls.

Where can I find documentation that describes the jquery methods and properties availabe from the objects returned by $find and $get.  I can't use intellisense because I'm working on a corporate project, where the team leader won't allow the insertion of JQuery intellesense libraries into the webpages.  Besides, I'm NOT looking for intellisense.  I need a printed list of methods/properties that I can use which I can reference and have a global view of.

 

Dan Lehmann
Top achievements
Rank 1
 answered on 01 Sep 2011
2 answers
70 views
Hi!
I'am trying to drag and copy one record from a Radgrid to another Radgrid, but at the moment only can Drag and Drop, i would like to just copy, records from Radgrid1 have to stay here.
Is it possible to do this?.
kharen
Top achievements
Rank 1
 answered on 01 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?