Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
200 views

I have a form in which i am using dataGrid to acess the data from the database.

Now on clicking the button a new Detailview page is open in which i want to retrieve value according to the button in which click.


My Default.aspx coding is


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    
    
     <script type="text/javascript" language="javascript">

   function OpenPopUp()
   {
   window.showModalDialog("child.aspx", ' ', 'dialogHeight:10; dialogWidth: 300px; dialogTop: 125px; dialogLeft: 100px; edge: Raised; center: Yes; resizable: No; status: Yes;');
    }
</script>

</head>
<body>
    <form id="form1" runat="server">
        
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />


       
   
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" OnNeedDataSource="RadGrid1_NeedDataSource"  GridLines="None" Height="750px" AllowSorting="True"  PageSize="8" AllowPaging="True">
            <MasterTableView AllowMultiColumnSorting="True" AutoGenerateColumns="False">
            <Columns>
            
                    <telerik:GridBoundColumn UniqueName="CITY_CODE" DataField="CITY_CODE" HeaderText="City Code" >
                        <HeaderStyle Width="200px" />
                    </telerik:GridBoundColumn>
                        
                        <telerik:GridBoundColumn UniqueName="NAME" DataField="NAME" HeaderText="Hotel Name" >
                            <HeaderStyle Width="200px" />
                        </telerik:GridBoundColumn>
                        
                         <telerik:GridBoundColumn UniqueName="ADDRESS_3" DataField="ADDRESS_3" HeaderText="City" >
                             <HeaderStyle Width="200px" />
                         </telerik:GridBoundColumn>
                        
                        <telerik:GridBoundColumn UniqueName="PHONE" DataField="PHONE" HeaderText="Phone Number" >
                            <HeaderStyle Width="200px" />
                        </telerik:GridBoundColumn>
                        </Columns>
                        
                        
                        
                        
                        
                        
                        
                        
             <ItemTemplate>
                    <%# (((GridItem)Container).ItemIndex != 0) ? "</td></tr></table>" : "</td></tr></table>"%>
                    <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'
                        runat="server" Width="326px" Height="122px">
                        
                        <asp:Label ID="titleLabel" runat="server" Text="City Code:" Font-Bold="true" style="float:left;width:30%;text-align:right"/>
                         <asp:Label ID="lblCityCode" runat="server" Text='<%# Eval("CITY_CODE") %>'/><br />
                         
                         
                        <asp:Label ID="Label6" runat="server" Text="Hotel Name:" Font-Bold="true" style="float:left;width:30%;text-align:right"/>
                         <asp:Label ID="Label1" runat="server" Text='<%# Eval("NAME") %>'/><br />
                         
                         
                        <asp:Label ID="Label7" runat="server" Text="Address:" Font-Bold="true" style="float:left;width:30%;text-align:right"/>                                                  
                          <asp:Label ID="lblAddress" runat="server" Text='<%# Eval("ADDRESS_1")+ ", " %>' /><br />
                          
                          
                          
                        <asp:Label ID="Label8" runat="server" style="float:left;width:30%;text-align:right"/>                                                  
                        <asp:Label ID="lblAddress2" runat="server" Text='<%# Eval("ADDRESS_2")+ ", " %>' /><br />
                        
                              
                              
                          <asp:Label ID="Label9" runat="server" style="float:left;width:30%;text-align:right"/>
                          <asp:Label ID="Label4" runat="server" Text='<%# Eval("ADDRESS_3")+ ", " %>' /><br />
                          
                          
                          <asp:Label ID="Label10" runat="server" style="float:left;width:30%;text-align:right"/>
                          <asp:Label ID="Label5" runat="server" Text='<%# Eval("ADDRESS_4") %>' /><br />
                          
                          
                        <asp:Label ID="Label11" runat="server" Text="Phone Number:" Font-Bold="true" style="float:left;width:30%;text-align:right"/>
                         <asp:Label ID="Label2" runat="server" Text='<%# Eval("PHONE") %>'/><br />
                         
                         
                         
                        <asp:Label ID="Label12" runat="server" Text="Fax:" Font-Bold="true" style="float:left;width:30%;text-align:right"/>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("FAX") %>'/>
                        <br />
                        
                        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
                        </telerik:RadWindowManager>
                        
                        
                        
                        
                         
                                             
                        
                        <button style="width: 40px; margin-bottom: 3px;" onclick="OpenPopUp()">More</button><br style="clear:both" /><br style="clear:both" />
                        

                    </asp:Panel>
                    </ItemTemplate>
                
            </MasterTableView>
            
            <GroupingSettings CaseSensitive="False" />
        </telerik:RadGrid>
    

    </form>
</body>
</html>



default.aspx.cs is

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        SqlConnection sqlConnection = new SqlConnection("Data Source = DELLVOSTRO; Initial Catalog = ALPHA; User Id= sa; Password= intransit");
        
        string selectString = "SELECT CITY_CODE,NAME,PHONE,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,FAX " + "FROM HOTELS ";

        SqlDataAdapter dataAdapter = new SqlDataAdapter(selectString, sqlConnection);
        DataTable table = new DataTable();
        dataAdapter.Fill(table);
        RadGrid1.DataSource = table;
        RadGrid1.DataBind();

    }



child.aspxis

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="child.aspx.cs" Inherits="child" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
 <title>Message Deatils</title>
</head>
<body>
    
    <script type="text/javascript">
    function GetRadWindow()
    {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)
          
        return oWindow;
    }
    function CloseWnd()
    {
        GetRadWindow().close();
    }

    function OnClientLoad(sender,args)
    {
        window.setTimeout(function()
        {
            sender.set_mode(2);
            sender.set_mode(1);
        }, 0);
    }
    </script>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadSkinManager ID="RadSkinManager" runat="server" Skin="Outlook">
        </telerik:RadSkinManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" />
        
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
            LoadingPanelID="RadLoadingPanel1">
            
            
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" Width="33%"
CellPadding="0" Height="100%" GridLines="None" OnPageIndexChanging="DetailsView1_PageIndexChanging">
                <Fields>
                    <asp:BoundField DataField="CITY_CODE" HeaderText="City Code:" SortExpression="CITY_CODE" >
                        <HeaderStyle Width="30%" />
                    </asp:BoundField>
                    <asp:BoundField DataField="NAME"  HeaderText="Hotel Name:" SortExpression="NAME" />
                    <asp:BoundField DataField="ADDRESS_1"  HeaderText="ADDRESS:" SortExpression="NAME" />
                    <asp:BoundField DataField="ADDRESS_2" SortExpression="NAME" />
                    <asp:BoundField DataField="ADDRESS_3" SortExpression="NAME" />
                    <asp:BoundField DataField="ADDRESS_4" SortExpression="NAME" />
                    <asp:BoundField DataField="PHONE"  HeaderText="Phone Number" SortExpression="NAME" />
                    <asp:BoundField DataField="FAX"  HeaderText="Fax" SortExpression="NAME" />    
                </Fields>
            </asp:DetailsView>
            <div style="text-align: right; margin-top:8px;">
               
                
            </div>
        </telerik:RadAjaxPanel>
        
  
        <telerik:RadAjaxLoadingPanel ID="RadLoadingPanel1" runat="server" >
        </telerik:RadAjaxLoadingPanel>
    </form>
</body>
</html>


child.aspx.cs is

public partial class child : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection sqlConnection = new SqlConnection("Data Source = DELLVOSTRO; Initial Catalog = ALPHA; User Id= sa; Password= intransit");

        string selectString = "SELECT CITY_CODE,NAME,PHONE,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,FAX " + "FROM HOTELS "+ "Where FAX = '"+label3.text+"'";

        SqlDataAdapter dataAdapter = new SqlDataAdapter(selectString, sqlConnection);
        DataTable table = new DataTable();
        dataAdapter.Fill(table);
        DetailsView1.DataSource = table;
        DetailsView1.DataBind();
    }
    protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
    {

    }
}

Veli
Telerik team
 answered on 11 Nov 2010
1 answer
108 views
Hi,
I am using RadDatePicker and have written the below given java script function to handle OnError event.
Now if I enter 505050 as the input i am getting the error "Enter a Valid Date in YYYY/MM/DD Format" multiple times if I press the "Enter" key to close the alert dialog which is very annoying. 
I am new to ASP.NET as well as Telerik controls. Please let me know what is going wrong.

ASPX
<telerik:RadDatePicker ID="dtmFromDt" runat="server" Width="100px"
   Visible="true" MinDate="1500/01/01" MaxDate="3000/01/01" DateInput-DateFormat="yyyy/MM/dd"                                                     Skin="WebBlue">
        <ClientEvents OnPopupClosing="OnPopupClosing"/>
<DateInput  runat="server" EmptyMessage="YYYY/MM/DD" Visible="true" ClientEvents-OnError="ShowDateError" >                     </DateInput>
<Calendar Skin="WebBlue" runat="server" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"                                                    ViewSelectorText="x">
</Calendar><DatePopupButton HoverImageUrl="" ImageUrl="" />
</telerik:RadDatePicker>
JavaScript 
function ShowDateError(sender, args)  
{  
alert ("Enter a Valid Date in YYYY/MM/DD Format");  
sender.focus();   
return false;
}

Please find attached image of code from a sample solution

Regards,
Murthy Meka
Dimo
Telerik team
 answered on 11 Nov 2010
1 answer
115 views
I've added a RadAjaxPanel around a custom control, called YesNoControl, which shows radio buttons for Yes, No, N/A (N/A is optional).

The YesNoControl has a Changed event that fires when the Value changes, and I've told this event to hide or show a div from just underneath it. This works perfectly, as far as I can tell.

The issue I have is with the LoadingPanel.  It only appears when clicking No.  When I click Yes, the div appears correctly, but no Loading Panel.  When I click No, the Loading Panel appears and the div is hidden.

I've got it showing the N/A radio button to test it further, and the Loading Panel only appears when Yes has been selected and No or N/A is then clicked.

Has anyone got an idea what may be causing this or how to get around it?

Thanks,
Guy
Dimo
Telerik team
 answered on 11 Nov 2010
1 answer
103 views
I want to use LoadOnDemand for a combobox. The comboBox is:

<telerik:RadComboBox ID="rcbProva" runat="server" EmptyMessage="Seleziona..." EnableLoadOnDemand="true" OnItemsRequested="rcbProva_ItemsRequested">
</telerik:RadComboBox>

I want to bind the radComboBox with a selectedValue but it seems not to work .
How can I set the SelectedValue of a RadComboBox using EnableLoadOnDemand=true? Anyone has an example?
Shinu
Top achievements
Rank 2
 answered on 11 Nov 2010
13 answers
299 views
Hello, i'm having some problems with the TabStrip control...

I'm trying to make a tabstrip linked to a MultiPageView using Ajax... the fact is that when I load the page, i can see the first tab with everything ok; when I click on the second tab, I get all the data and is working OK... but if I try to return to the first tab I can't, it simply doesn't do anything.

I'm using a RadAjaxManager like this:
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="Tabs1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Tabs1" /> 
                    <telerik:AjaxUpdatedControl ControlID="Pages" LoadingPanelID="LoadingPanel" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="Pages">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="Pages" LoadingPanelID="LoadingPanel" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 

If I delete de Manager everything is working fine, excepting the fact that it's reloading the entire page.

This is the code behind:
protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!Page.IsPostBack)  
            {  
                AddTab("Vista en Arbol");  
                AddPageView(Tabs1.FindTabByText("Vista en Arbol"));  
                AddTab("Vista en Tabla");  
            }  
        }  
        private void AddTab(string tabName)  
        {  
            RadTab tab = new RadTab();  
            tab.Text = tabName;  
            Tabs1.Tabs.Add(tab);  
        }  
        private void AddPageView(RadTab tab)  
        {  
            RadPageView pageView = new RadPageView();  
            pageView.ID = tab.Text;  
            Pages.PageViews.Add(pageView);  
            tab.PageViewID = pageView.ID;  
        }  
        protected void Tabs1_TabClick(object sender, RadTabStripEventArgs e)  
        {  
            AddPageView(e.Tab);  
            e.Tab.PageView.Selected = true;  
        }  
        protected void Pages_PageViewCreated(object sender, RadMultiPageEventArgs e)  
        {  
            string userControlName="";  
            if (e.PageView.ID == "Vista en Arbol")  
            {                   
                userControlName ="~/visitas/conexionesAJAX.ascx";  
            }  
            else if (e.PageView.ID == "Vista en Tabla")  
            {  
                userControlName ="~/visitas/conexionesGRID.ascx";  
            }  
 
            Control userControl = Page.LoadControl(userControlName);  
            userControl.ID = e.PageView.ID + "_userControl";  
 
            e.PageView.Controls.Add(userControl);  
        } 

I don't know where is my error... hope u can help me.

Thanks
Yana
Telerik team
 answered on 11 Nov 2010
1 answer
99 views
Is deep binding supported on the combo box as it is in some of the other controls?

ie. 
rcbCusts.DataTextField = "Customer.Name";
rcbCusts.DataValueField = "Customer.Id";

I assume since it blows up on my databind it is not possible, but I wanted to make sure since I could not find anything on it...

~james
Simon
Telerik team
 answered on 11 Nov 2010
1 answer
90 views

We have a need to fire a spell check before an email gets sent out. The idea being, user clicks “Send” and once the spellcheck is complete, it would send without further interaction. This works with the following script very well. The only issue we have is that is distinguishing between whether the user clicked on “Cancel” on the spellchecker in RadEditor or the spell check completed. When the user clicks Cancel, we don’t want to send the email.

 

Is there any way to know what condition fired the function attached to add_spellCheckEnd ? Or an alternative method?

 

    <script type="text/javascript">

                  

        function SpellCheckAndSubmit() {

            var editor = $find("<%=textEdit.RadEditorClientID%>");

            var sendButton = document.getElementById("<%=btnSendEmail.ClientID%>");

            editor.fire("AjaxSpellCheck");

 

            setTimeout(function() {

                var spell = editor.get_ajaxSpellCheck();

                spell.add_spellCheckEnd(function(sender, args) {

                //if Cancelled Button Hit

                //Do nothing

                //else

                //Do Event  

                    sendButton.click();

                });

            }, 100);

            return false;

        }

    </script>

Any help you can provide would be appreciated.

Thanks
Martin Cheverall

Dobromir
Telerik team
 answered on 11 Nov 2010
6 answers
431 views
We are currently using RadAjax, and we would love to switch to the "Prometheus" version. However, the RadCodeBlock issue will probably keep us from moving forward at this time. I'd like to put a RadAjaxManager in our master page, but we have hundreds of pages with <%%> expressions in them, and surrounding all of them with RadCodeBlock is a daunting task.

Somehow, Microsoft's ASP.NET AJAX framework and UpdatePanel is able to work without a need for RadCodeBlock. It seems that there must be a way to make RadAjax "Prometheus" work without requiring RadCodeBlock.

Unfortunately, until this issue is addressed, we probably will be unable to switch to RadAjax "Prometheus." Please give serious consideration to finding another solution other than RadCodeBlock.
Sebastian
Telerik team
 answered on 11 Nov 2010
2 answers
190 views
Hi
How can I set the Default Insert mode for radgrid on initial load
Thanks
Anis
Top achievements
Rank 1
 answered on 11 Nov 2010
5 answers
291 views
Adding the ClientEvents OnCommand property to the RadGrid appears to break the Grid's paging functionality.

I have:

<script type="text/javascript">
    function TestFunction() {
    } 
</script>

<telerik:RadGrid ID="RadGrid1" runat="server"
    OnNeedDataSource="RadGrid1_NeedDataSource"
    AllowSorting="true"
    AutoGenerateColumns="false"
    AllowPaging="true"
    PageSize="100"
    EnableEmbeddedSkins="false"
    Skin="Web20">
    <PagerStyle Mode="NextPrevAndNumeric" PrevPageImageUrl="PagingPrev.gif" NextPageImageUrl="PagingNext.gif" FirstPageImageUrl="PagingFirst.gif" LastPageImageUrl="PagingLast.gif"></PagerStyle>
    <ClientSettings>
 <ClientEvents OnCommand="TestFunction" />
 <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="300px" />
    </ClientSettings> ...

When <ClientEvents OnCommand="TestFunction" /> is declared, the paging controls in the grid look and act weird: For instance, in paging controls "Displaying page X of X, items X to X of X" all of the Xs become grayed out. Also, the "Change page: < 1, 2, 3 >" controls don't change appearance to indicate the page you are on.  However, the paging functionality still works.

When I remove the <ClientEvents OnCommand="TestFunction" /> declaration, the grid's paging goes back to normal.

Is this a bug?
Tsvetina
Telerik team
 answered on 11 Nov 2010
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?