Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
32 views
Hi.

I save 3 images in the folder and images name in the database. Like this i added 3 records. Here is my code

  foreach (UploadedFile f in RadUpload1.UploadedFiles)
            {
                string strfolder;
                dataquery dq = new dataquery();
                string strsql;
                strfolder = Server.MapPath("../noon");
                f.SaveAs(strfolder + "\\" + f.GetName(), true);
                strsql = "insert into images(imid,imagname) values('1','" + f.GetName() + "')";
                dq.ExecuteQuery(strsql);
            }
Now i want to update my record and images. but i do't know how to show images in the Radupload control or then i what to write code for update.

Please can you see my above code and help me to write update code and select record images in the Radupload. I am not using Radgrid.

Thank you so much for help.

 

 

 

 

 

 

 

Peter Filipov
Telerik team
 answered on 04 May 2011
3 answers
122 views
I added an image button to the title bar in code behind, everything works well but when hovering over the button I get the drag cursor and I can not click the image Button. This happen only in IE8 , in chrome it works perfectly ( I am able to click the image button).

Any ideas?      
Pero
Telerik team
 answered on 04 May 2011
1 answer
117 views
Failed to Load Viewstate Problem
Whenever, I try to upload with the RadAsyncUpload control I get the following error.

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.


Is there something I need to do to avoid this problem?
Peter Filipov
Telerik team
 answered on 04 May 2011
1 answer
330 views
I like this feature that limits the filtering options in the RadGrid based on the column's data type.

Is there a way to override which options are available for a particular data type?  (I'm manually implementing the web service data source for the grid, and I'm have not implemented all of them yet.)
Iana Tsolova
Telerik team
 answered on 04 May 2011
3 answers
1.3K+ views
I want to remove cell padding space in the telerik grid coloumn
Galin
Telerik team
 answered on 04 May 2011
1 answer
227 views
Hi Guys, 

I have a problem Im hoping you can help me with.  

I have a RadGrid, with a RadFilter on it.  The RadFilter button is an ItemCommand on the RadGrid.  I have since put another ItemCommand on to call a RadWindow to display my insert record aspx page.  

However I cant seem to get the ItemCommand to link to the Call Function

Here is the ASPX Code
<CommandItemTemplate>
                    <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick Skin="WebBlue">
                        <Items>
                            <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid"
                            ImageUrl="~/Images/Refresh.gif"/>
                            <telerik:RadToolBarButton Text="Add new" CommandName="xInsert"
                            ImageUrl="~/Images/AddRecord.gif" />                 
                             
                        </Items>
                    </telerik:RadToolBar>
                     
                </CommandItemTemplate>


Here is my VB Code
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
        If e.CommandName = "FilterRadGrid" Then
            RadFilter1.FireApplyCommand()
        Else
            If e.CommandName = "xInsert" Then
                Dim newWindow As New Telerik.Web.UI.RadWindow()
                newWindow.ID = "InsertWindow"
                newWindow.NavigateUrl = "~/XDW/EditPalletQty.aspx"
                newWindow.VisibleOnPageLoad = True
                RadWindowManager1.Windows.Add(newWindow)
 
 
            End If
 
        End If
    End Sub

The filter works great however I cant seem to get the RadGrid to fire.  I have also tried calling the client side javascript from the VB code however that didnt fire either.

Any help is appriciated.

Cheers
Joel
Iana Tsolova
Telerik team
 answered on 04 May 2011
1 answer
109 views
Hi,
i am using radfilter for my crystalreport. Now i am not using fieldeditor & listview (it is set display : none becz no need for me) in it , all expression i am adding with sqldatasorce.

(like below)
<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
<%@ Register Assembly="Telerik.Web.UI, Version=2010.2.929.35, Culture=neutral, PublicKeyToken="5689dfr78165798545"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>



<telerik:RadFilter ID="RadFilter3" runat="server"  
            FilterContainerID="RadListView2"  ExpressionPreviewPosition="Bottom"    onapplyexpressions="RadFilter3_ApplyExpressions" 
        CssClass="RadComboBox_Default" onitemcommand="RadFilter3_ItemCommand"    >

 <telerik:RadListView ID="RadListView2" DataSourceID="ChargeSelection" Width="100%"
                    PageSize="6" AllowPaging="True" runat="server">
                    
                      <ItemTemplate >
                        <div class="rlvA" style="height: 120px; width: 270px; margin-top: 5px; margin-left: 2px;
                            margin-bottom: 20px; padding-left: 10px; border-style: none; display:none; ">
                            <fieldset style="height: 100%">
                                <table>
                                    <tr>
                                        <td>
                                            <strong>OrderID:</strong>
                                            <asp:Label ID="OrderIDLabel" runat="server" />
                                            <br />
                                            <strong>Order date:</strong>
                                            <asp:Label ID="OrderDateLabel" runat="server" />
                                            <br />
                                            <strong>Ship city:</strong>
                                            <asp:Label ID="ShipCityLabel" runat="server" />
                                            <br />
                                            <strong>Ship country:</strong>
                                            <asp:Label ID="ShipCountryLabel" runat="server" />
                                            <br />
                                            <strong>Ship name:</strong>
                                            <asp:Label ID="ShipNameLabel" runat="server" />
                                            <br />
                                        </td>
                                        <td>
                                            <img src="Img/ordertracking.gif" alt="" />
                                        </td>
                                    </tr>
                                </table>
                            </fieldset>
                        </div>
                    </ItemTemplate>
                   
                </telerik:RadListView>

<asp:SqlDataSource ID="ChargeSelection" ConnectionString="<%$ ConnectionStrings:PMNotesString %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT CPTCode,ChargeId,Date1,Account# FROM View_1"
    runat="server" ></asp:SqlDataSource>

 (see attach file)
Now when i select on add expression like  " Date1 - equals to - 3/21/2011 12:00 AM"  from radfilter.  In this expression you can see that date will be selected using calendar pop up & there is also time view pop up. So my problem is that i want to disable time view pop up becz no need for me &  also change date formate using calender pop up like  YYYY-MM-dd  (2011-03-21)  . Is it possible with RadFilter??? . If it is than please let me know how it could be possible??

Thank you
Ronak
Iana Tsolova
Telerik team
 answered on 04 May 2011
2 answers
85 views
Hi!

I have a strange behaviour in my web site. I load your radEditor via jquery/wcf (markup as below).

            <telerik:RadEditor ID="bindHtml" runat="server" 
                Height="400px" 
                EnableViewState="false" 
                AllowScripts="true"
                ClientIdMode="Static"
                RegisterWithScriptManager="false" />

In Chrome and IE this works fine. in FireFox I can´t change i design mode. Html mode works but not design. Any thoughts? /David
Dobromir
Telerik team
 answered on 04 May 2011
1 answer
69 views

Posted 21 hours ago (permalink)

Hey,

I have a problem where my RadioButton is changing back to a CheckBox in the RadGrid after a Button_Click.

The datasource is done programatically.

Column(0) of the datasource is a Boolean

So when the grid renders it would usually display a checkbox for Column(0).

At the ItemDataBound event I am removing the CheckBox and replacing it with a RadioButton.

This all works great with some javascript making sure only one RadioButton is selected at a time.

However when I try to retrieve the selected row on a Button_Click event the grid rebinds to the datasource and i loose the radiobuttons?

Is there a way to prevent any further binding after I have put my radio buttons?

Any help would be greatly appreciated.
Radoslav
Telerik team
 answered on 04 May 2011
12 answers
254 views
which row i click that row name go to top of second asp:textbox




using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using System.Data.SqlClient;
using System.Configuration;
using TBSDataLayer;

namespace TBS_HelpDesk.Views.Assets
{
    public partial class NewModels : System.Web.UI.Page
    {
        public static string Manuf_ID;
        private SqlDataAdapter sqladp;
        private SqlCommand sqlcmd;
        private DataTable dtTable;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Manuf_ID = "0";
            }
        }

        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            AssetModel oAssetModel = new AssetModel();
            RadGrid1.DataSource = oAssetModel.fetchAssetManufacturer();
        }

        protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            AssetModel oAssetModel = new AssetModel();
            RadGrid2.DataSource = oAssetModel.fetchAssetModel(Manuf_ID);
        }

        protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            dtTable = new DataTable();
            sqladp = new SqlDataAdapter();
            sqlcmd = new SqlCommand();
            Manufacturers oManufacturers = new Manufacturers();

            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {

                if (e.Item is GridEditFormItem)
                {
                    GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
                    TextBox Manuf_Name = (e.Item as GridEditFormInsertItem)["Manuf_Name"].Controls[0] as TextBox;
                    TextBox Manuf_Description = (e.Item as GridEditFormInsertItem)["Manuf_Description"].Controls[0] as TextBox;
                    CheckBox Manuf_Inactive = (e.Item as GridEditFormInsertItem)["Manuf_Inactive"].Controls[0] as CheckBox;

                    //GridEditFormItem item = (GridEditFormItem)e.Item;
                    //TextBox Manuf_Name = (TextBox)item.FindControl("Manuf_Name");
                    //TextBox Manuf_Description = (TextBox)item.FindControl("Manuf_Description");
                    //CheckBox Manuf_Inactive = (CheckBox)item.FindControl("Manuf_Inactive");
                    // newly changed

                    oManufacturers.Manuf_Name = Manuf_Name.Text;
                    oManufacturers.Manuf_Description = Manuf_Description.Text;
                    oManufacturers.Manuf_Inactive = Manuf_Inactive.Checked;

                    try
                    {
                        RadGrid1.DataSource = oManufacturers.AddManufacturers(oManufacturers.Manuf_Name, oManufacturers.Manuf_Description, oManufacturers.Manuf_Inactive);
                    }
                    catch (Exception ex)
                    {
                        RadGrid1.Controls.Add(new LiteralControl("Unable to insert Employee. Reason: " + ex.Message));
                    }
                    RadGrid1.MasterTableView.IsItemInserted = false;
                    RadGrid1.DataBind();
                    e.Canceled = true;
                }
                //GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
                //TextBox Manuf_Name = (e.Item as GridEditFormInsertItem)["Manuf_Name"].Controls[0] as TextBox;
                //TextBox Manuf_Description = (e.Item as GridEditFormInsertItem)["Manuf_Description"].Controls[0] as TextBox;
                //CheckBox Manuf_Inactive = (e.Item as GridEditFormInsertItem)["Manuf_Inactive"].Controls[0] as CheckBox;

            }
            else if (e.CommandName == RadGrid.UpdateCommandName)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;

                if (e.Item is GridEditFormItem)
                {
                    GridEditFormItem item = (GridEditFormItem)e.Item;
                    TextBox Manuf_ID = (e.Item as GridEditableItem)["Manuf_ID"].Controls[0] as TextBox;
                    TextBox Manuf_Name = (e.Item as GridEditableItem)["Manuf_Name"].Controls[0] as TextBox;
                    TextBox Manuf_Description = (e.Item as GridEditableItem)["Manuf_Description"].Controls[0] as TextBox;
                    CheckBox Manuf_Inactive = (e.Item as GridEditableItem)["Manuf_Inactive"].Controls[0] as CheckBox;

                    //GridEditFormItem item = (GridEditFormItem)e.Item;
                    //TextBox Manuf_ID = (TextBox)item.FindControl("Manuf_ID");
                    //TextBox Manuf_Name = (TextBox)item.FindControl("Manuf_Name");
                    //TextBox Manuf_Description = (TextBox)item.FindControl("Manuf_Description");
                    //CheckBox Manuf_Inactive = (CheckBox)item.FindControl("Manuf_Inactive");

                    oManufacturers.Manuf_ID = Convert.ToInt32(Manuf_ID.Text);
                    oManufacturers.Manuf_Name = Manuf_Name.Text;
                    oManufacturers.Manuf_Description = Manuf_Description.Text;
                    oManufacturers.Manuf_Inactive = Manuf_Inactive.Checked;

                    try
                    {
                        RadGrid1.DataSource = oManufacturers.ModManufacturers(oManufacturers.Manuf_ID, oManufacturers.Manuf_Name, oManufacturers.Manuf_Description, oManufacturers.Manuf_Inactive);
                    }
                    catch (Exception ex)
                    {
                        RadGrid1.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));

                    }
                    RadGrid1.EditIndexes.Clear();
                    RadGrid1.DataBind();
                    e.Canceled = true;

                }
                //RadNumericTextBox Manuf_ID = (e.Item as GridEditableItem)["Manuf_ID"].Controls[0] as RadNumericTextBox;
                //TextBox Manuf_Name = (e.Item as GridEditableItem)["Manuf_Name"].Controls[0] as TextBox;
                //TextBox Manuf_Description = (e.Item as GridEditableItem)["Manuf_Description"].Controls[0] as TextBox;
                //CheckBox Manuf_Inactive = (e.Item as GridEditableItem)["Manuf_Inactive"].Controls[0] as CheckBox;


            }
            else if (e.CommandName == RadGrid.DeleteCommandName)
            {
                GridDataItem item = (GridDataItem)e.Item;
                Int32 Manuf_ID = Convert.ToInt32(item["Manuf_ID"].Text);

                try
                {
                    RadGrid1.DataSource = oManufacturers.DelManufacturers(Manuf_ID);

                }
                catch (Exception ex)
                {
                    RadGrid1.Controls.Add(new LiteralControl("Unable to delete Id. Reason: " + ex.Message));
                    e.Canceled = true;
                }

            }
            else if (e.CommandName == "RowClick")
            {
                GridDataItem item = (GridDataItem)e.Item;
                Manuf_ID = item["Manuf_ID"].Text;
                string Manuf_Name = item["Manuf_Name"].Text;
                ModelText.Text = "Model For " + item["Manuf_Name"].Text;
                RadGrid2.DataSource = null;
                RadGrid2.Rebind();
                ModelText.Text = "Model For " + Manuf_Name;
                //e.Row.Cells[1].ForeColor = System.Drawing.Color.Red;
            }
        }

        protected void RadGrid2_ItemCommand(object sender, GridCommandEventArgs e)
        {

            dtTable = new DataTable();
            sqladp = new SqlDataAdapter();
            sqlcmd = new SqlCommand();
            AssetModel oAssetModel = new AssetModel();

            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;

                RadNumericTextBox Model_ID = (e.Item as GridEditFormInsertItem)["Model_ID"].Controls[0] as RadNumericTextBox;
                TextBox Model_Name = (e.Item as GridEditFormInsertItem)["Model_Name"].Controls[0] as TextBox;
                TextBox Model_Description = (e.Item as GridEditFormInsertItem)["Model_Description"].Controls[0] as TextBox;
                oAssetModel.Model_Manuf_ID = Convert.ToInt16(Manuf_ID);
                oAssetModel.Model_Name = Model_Name.Text;
                oAssetModel.Model_Description = Model_Description.Text;

                try
                {
                    RadGrid2.DataSource = oAssetModel.AddAssetModel(oAssetModel.Model_Manuf_ID, oAssetModel.Model_Name, oAssetModel.Model_Description);
                }
                catch (Exception ex)
                {
                    RadGrid2.Controls.Add(new LiteralControl("Unable to insert Employee. Reason: " + ex.Message));
                }
                RadGrid2.MasterTableView.IsItemInserted = false;
                RadGrid2.DataBind();
                e.Canceled = true;
            }

            else if (e.CommandName == RadGrid.UpdateCommandName)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;

                RadNumericTextBox Model_ID = (e.Item as GridEditableItem)["Model_ID"].Controls[0] as RadNumericTextBox;
                TextBox Model_Name = (e.Item as GridEditableItem)["Model_Name"].Controls[0] as TextBox;
                TextBox Model_Description = (e.Item as GridEditableItem)["Model_Description"].Controls[0] as TextBox;

                oAssetModel.Model_Manuf_ID = Convert.ToInt16(Manuf_ID);
                oAssetModel.Model_ID = Convert.ToInt16(Model_ID.Text);
                oAssetModel.Model_Name = Model_Name.Text;
                oAssetModel.Model_Description = Model_Description.Text;

                try
                {
                    RadGrid2.DataSource = oAssetModel.ModAssetModel(oAssetModel.Model_Manuf_ID, oAssetModel.Model_ID, oAssetModel.Model_Name, oAssetModel.Model_Description);
                }
                catch (Exception ex)
                {
                    RadGrid2.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));

                }
                RadGrid2.EditIndexes.Clear();
                RadGrid2.DataBind();
                e.Canceled = true;

            }

            else if (e.CommandName == RadGrid.DeleteCommandName)
            {

                GridDataItem item = (GridDataItem)e.Item;
                oAssetModel.Model_Manuf_ID = Convert.ToInt16(Manuf_ID);
                Int32 Model_ID = Convert.ToInt16(item["Model_ID"].Text);


                try
                {
                    RadGrid2.DataSource = oAssetModel.DelAssetModel(oAssetModel.Model_Manuf_ID, Model_ID);
                }
                catch (Exception ex)
                {
                    RadGrid2.Controls.Add(new LiteralControl("Unable to delete Id. Reason: " + ex.Message));
                    e.Canceled = true;
                }

            }
        }

        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {

        }
        protected void RadToolBar2_ButtonClick(object sender, RadToolBarEventArgs e)
        {

        }

    }
}



Thanks
Mohamed
mohamed
Top achievements
Rank 1
 answered on 04 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?