Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
220 views
hi!

   I want store and retrive textfile or Imagefile into sql database using radupload control...........can  any one bring the sample code to me?

thank you....
       
Priya Priya
Top achievements
Rank 1
 answered on 09 Oct 2009
1 answer
69 views
Hi,
I have set enableviewstate to false on my grid but now it's not fireing the delete command anymore.
What do I need to do if I want to continue having viewstate off?

/Mattias
Mira
Telerik team
 answered on 09 Oct 2009
2 answers
205 views

Hello,

I have a problem using custom skinning in RadEditor.
I have tried the solution mentioned in the installation manual delivered with our version (2008.3 1314)
Appearance > Create New Skin
Appearance > DialogsCssFile Property

The editor itself takes the custom skin but the context menu en the <Hyperlink manager> control(s) doesn't.

When I don't use custom skinning the controls are beeing loaded by the Telerik.Web.UI.DialogHandler.aspx but then i have the problem that the resources are not beeing loaded, so i do have the controls but no text.
All the proper .resx files are in the App_globalResources folder.

I have attached 2 screens. The first is an example of the directory structure and the second attachement shows how the linkManager is beeing loaded.

thx.

Gerco

 

Rumen
Telerik team
 answered on 09 Oct 2009
0 answers
93 views

hi!
     I upload a file to database using below code...the below code is performed well in aspx page...but I want this in usercontrol that is ascx page...when use this code in ascx control , if i press upload button, can not get uploaded file in for loop(below bolded line)..so , for loop inner statement does not executed..So i cannot insert Image file into database..can anyone help me? thanks


Radupload control

 

 

<asp:TextBox ID="txtName" runat="server"></asp:TextBox>

 

 

<telerik:RadUpload ID="FileUpload1" Runat="server"/><br/>

 

 

<br />

 

 

<asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" /><br />

 

 

<br />

 

 

<asp:Label ID="lblMessage" runat="server"></asp:Label><br />

 

 

 

btnupload click event
protected
void btnUpload_Click(object sender, EventArgs e)

 

{

 

foreach (UploadedFile file in FileUpload1.UploadedFiles)

 

{

 

byte[] bytes = new byte[file.InputStream.Length];

 

file.InputStream.Read(bytes, 0, (

int)(file.InputStream.Length));

 

 

string strImageName = txtName.Text.ToString();

 

 

 

// Create SQL Connection

 

 

SqlConnection con = new SqlConnection();

 

con.ConnectionString =

ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

 

 

// Create SQL Command

 

 

SqlCommand cmd = new SqlCommand();

 

cmd.CommandText =

"Ins_Files";

 

cmd.CommandType =

CommandType.StoredProcedure;

 

cmd.Connection = con;

 

SqlParameter ImageName = new SqlParameter("@ImageName", SqlDbType.VarChar, 50);

 

ImageName.Value = strImageName.ToString();

cmd.Parameters.Add(ImageName);

 

SqlParameter UploadedImage = new SqlParameter("@Image", SqlDbType.Image, bytes.Length);

 

UploadedImage.Value = bytes;

cmd.Parameters.Add(UploadedImage);

con.Open();

 

int result = cmd.ExecuteNonQuery();

 

con.Close();

 

if (result > 0)

 

lblMessage.Text =

"File Uploaded";

 

 

}

Priya Priya
Top achievements
Rank 1
 asked on 09 Oct 2009
1 answer
129 views
Hi,

I am using asp.net gridview with some imagebuttons. On click of those imagebuttons, i am opening greybox popups.
Now when user closes the greybox, it reloads the main page, with the help of one hidden button click, "   __doPostBack('ctl00$cphMainContent$btnPostBck',''); ".

I want to display the Loading image over the grid, when it reloads the page. Here is a code I am using.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="Panel1"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="btnPostBck" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <asp:Panel ID="Panel1" runat="server" HorizontalAlign="Center" Width="100%" Height="100%" 
        BorderWidth="1px"
        <table id="Table1" cellspacing="0" cellpadding="0" border="0" align="center" class="MainTable"
            <tr> 
                <td valign="top"
                    <table id="Table3" cellspacing="0" cellpadding="2" border="0" width="100%" align="center" 
                        class="InnerTable"
                        <tr> 
                            <td colspan="2"
                                <telerik:RadXmlHttpPanel ID="XmlHttpPanelGrid" runat="server" OnServiceRequest="XmlHttpPanel_ServiceRequest"
                                    <table width="100%"
                                        <tr> 
                                            <td> 
                                                <asp:GridView ID="dtBook" runat="server" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="False" 
                                                    BorderStyle="solid" CellPadding="4" DataKeyNames="BookID,writerid,ExerciseVideos" 
                                                    HeaderStyle-CssClass="pagelabel" HorizontalAlign="Left" PageSize="30" RowStyle-Wrap="true" 
                                                    Width="100%"
                                                    <HeaderStyle CssClass="pagelabel" /> 
                                                    <RowStyle CssClass="pagelabel" /> 
                                                    <AlternatingRowStyle CssClass="AltPageLabel" /> 
                                                    <SelectedRowStyle BackColor="#FFFFC0" /> 
                                                    <EmptyDataTemplate> 
                                                        <asp:Label ID="lblNoData" runat="server" Style="text-align: center;" ForeColor="red" 
                                                            Text="<%$ Resources:WebResource , Logbook_Norecord%>"></asp:Label></EmptyDataTemplate> 
                                                    <PagerStyle Font-Names="Verdana" HorizontalAlign="Center"></PagerStyle> 
                                                    <Columns> 
                                                        <asp:TemplateField HeaderText="<%$ Resources:WebResource , BookRead_Date%>" SortExpression="Bookdate"
                                                            <ItemStyle CssClass="pagelabel" Width="10%" /> 
                                                            <HeaderStyle HorizontalAlign="Left" Width="10%" /> 
                                                            <ItemTemplate> 
                                                                <asp:Label ID="lblDate" runat="server"></asp:Label><br /> 
                                                                <asp:Label ID="lblFor" runat="server" Text="<%$ Resources:WebResource , BookRead_For%>"></asp:Label> 
                                                                <asp:Label ID="lblType" runat="server"></asp:Label> 
                                                            </ItemTemplate> 
                                                        </asp:TemplateField> 
                                                        <asp:TemplateField> 
                                                            <ItemStyle CssClass="pagelabel" Width="10%" /> 
                                                            <HeaderStyle HorizontalAlign="Left" Width="10%" /> 
                                                            <HeaderTemplate> 
                                                                <asp:Label ID="Label2" runat="server" Text="<%$ Resources:WebResource , BookRead_Comments %>"></asp:Label> 
                                                            </HeaderTemplate> 
                                                            <ItemTemplate> 
                                                                <asp:HiddenField ID="hidId" runat="server" Value='<%# Eval("Bookid") %>' /> 
                                                                <table border="0" align="center" width="100%"
                                                                    <tr> 
                                                                        <td> 
                                                                            &nbsp; 
                                                                            <asp:ImageButton ID="lnkAdd" runat="server" ImageUrl="~/Images/comment1.png" CommandArgument='<%Eval("Bookid") %>' 
                                                                                CommandName="UploadVideo" ToolTip="<%$ Resources:WebResource , BookRead_Comments_Add %>" /> 
                                                                        </td> 
                                                                        <td> 
                                                                            &nbsp; 
                                                                            <asp:ImageButton ID="lnkView" runat="server" ImageUrl="~/Images/comment3.png" ToolTip="<%$ Resources:WebResource , BookRead_Comments_Read %>"
                                                                            </asp:ImageButton> 
                                                                        </td> 
                                                                    </tr> 
                                                                    <tr style="display: none;"
                                                                        <td> 
                                                                            &nbsp;</td> 
                                                                        <td align="center"
                                                                            <asp:Label ID="lblCommentCount" runat="server" ForeColor="green"></asp:Label> 
                                                                        </td> 
                                                                    </tr> 
                                                                </table> 
                                                            </ItemTemplate> 
                                                        </asp:TemplateField> 
                                                    </Columns> 
                                                    <PagerStyle Font-Names="Verdana" HorizontalAlign="Center"></PagerStyle> 
                                                </asp:GridView> 
                                            </td> 
                                        </tr> 
                                    </table> 
                                </telerik:RadXmlHttpPanel> 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
        </table> 
        <asp:Button ID="btnPostBck" runat="server" Text="Postback" CausesValidation="false" 
            Visible="false" /> 
    </asp:Panel> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" BackgroundPosition="center" 
        EnableSkinTransparency="false" Height="75px" Width="75px" Transparency="25"
        <asp:Image ID="Image1" runat="server" ImageUrl="../Images/Loading/loading-spiral.gif"
        </asp:Image> 
        <img src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' 
            alt="Loading..." style="border: 0;" /> 
    </telerik:RadAjaxLoadingPanel> 



Protected Sub btnPostBck_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnPostBck.Click      
        Response.Redirect("bookread.aspx"False
    End Sub 


But this is not working as per my requirement. Where I am doing wrong??



Protected Sub btnPostBck_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnPostBck.Click      
        Response.Redirect("bookread.aspx"False
    End Sub 




Pavlina
Telerik team
 answered on 09 Oct 2009
2 answers
157 views
Hi

I am using Q2 2009 version of Telerik. I have a grid control. I want coulmn Header Text when i click on particular column  through JavaScript. i tried to get the value with  innerText and innerHTML.but  i think it is not supporting.

Please give me the solutions ASAP

Regards

Rahul
Rahul Khinvasara
Top achievements
Rank 1
 answered on 09 Oct 2009
3 answers
98 views
Hello,

I'm using EntityDataSource with table User. I have also included table Transport related to User.
I have a column in my grid
<telerik:GridBoundColumn DataField="Transport.City" DataType="System.String" HeaderText="Transport" UniqueName="Transport" /> 

Filtering "IsEmpty" and "IsNull" and "NotIsNull" always return empty grig, while "NotIsEmpty" works perfect.
I guess it's because User can have Transport = null, and I'm binding column to Transport.City.

Please help, I realy need "IsEmpty" filter to work.
Tsvetoslav
Telerik team
 answered on 09 Oct 2009
5 answers
92 views
hey.. I am attempting to get my grid to save their custom grouped setting for each of my users via the asp.net profile objects. this works for me when i am not using the ajax manager. (I am using the grid settings persistor sample for the guidelines. )
My question is this.. how to save the grid settings when the ajax call avoids the Render Sub.. I hae tried the goups changing but found that really ugly as you would have to apply it on each grid in the page.  ( it also blew up each time saying the object no longer existed if you moved an item out)
If you have any ideas I would appreciate hearing them
.class file
Imports Microsoft.VisualBasic  
'Namespace WebApplication1  
Imports System  
Imports System.Collections  
Imports System.IO  
Imports System.Web.UI  
Imports System.Web.UI.WebControls  
Imports Telerik.Web.UI  
 
 
Public Class GridSettingsPersister  
 
    Private gridInstance As RadGrid  
 
    Public Sub New(ByVal gridInstance As RadGrid)  
        MyBase.New()  
        Me.gridInstance = gridInstance  
    End Sub  
 
    'this method should be called on Render  
    Public Function SaveSettings() As String  
        Dim gridSettings() As Object = New Object((4) - 1) {}  
        'Save groupBy  
        Dim groupByExpressions As GridGroupByExpressionCollection = gridInstance.MasterTableView.GroupByExpressions  
        Dim groupExpressions() As Object = New Object((groupByExpressions.Count) - 1) {}  
        Dim count As Integer = 0 
        For Each expression As GridGroupByExpression In groupByExpressions  
            groupExpressions(count) = CType(expression, IStateManager).SaveViewState  
            count = (count + 1)  
        Next  
        gridSettings(0) = groupExpressions  
        'Save sort expressions  
        gridSettings(1) = CType(gridInstance.MasterTableView.SortExpressions, IStateManager).SaveViewState  
        'Save columns order  
        Dim columnsLength As Integer = (gridInstance.MasterTableView.Columns.Count + gridInstance.MasterTableView.AutoGeneratedColumns.Length)  
        Dim columnOrder() As Pair = New Pair(columnsLength - 1) {}  
 
        Dim allColumns As ArrayList = New ArrayList(columnsLength)  
        allColumns.AddRange(gridInstance.MasterTableView.Columns)  
        allColumns.AddRange(gridInstance.MasterTableView.AutoGeneratedColumns)  
        Dim i As Integer = 0 
        For Each column As GridColumn In allColumns  
            Dim p As Pair = New Pair  
            p.First = column.OrderIndex  
            p.Second = column.HeaderStyle.Width  
            columnOrder(i) = p  
            i = (i + 1)  
        Next  
        gridSettings(2) = columnOrder  
        'Save filter expression  
        gridSettings(3) = CType(gridInstance.MasterTableView.FilterExpression, Object)  
 
        Dim formatter As LosFormatter = New LosFormatter  
        Dim writer As StringWriter = New StringWriter  
        formatter.Serialize(writer, gridSettings)  
        Return writer.ToString  
    End Function  
 
    'this method should be called on PageInit  
    Public Sub LoadSettings(ByVal settings As String)  
        Dim formatter As LosFormatter = New LosFormatter  
        Dim reader As StringReader = New StringReader(settings)  
        Dim gridSettings() As Object = CType(formatter.Deserialize(reader), Object())  
        'Load groupBy  
        Dim groupByExpressions As GridGroupByExpressionCollection = Me.gridInstance.MasterTableView.GroupByExpressions  
        groupByExpressions.Clear()  
        Dim groupExpressionsState() As Object = CType(gridSettings(0), Object())  
        Dim count As Integer = 0 
        For Each obj As Object In groupExpressionsState  
            Dim expression As GridGroupByExpression = New GridGroupByExpression  
            CType(expression, IStateManager).LoadViewState(obj)  
            groupByExpressions.Add(expression)  
            count = (count + 1)  
        Next  
        'Load sort expressions  
        Me.gridInstance.MasterTableView.SortExpressions.Clear()  
        CType(Me.gridInstance.MasterTableView.SortExpressions, IStateManager).LoadViewState(gridSettings(1))  
        'Load columns order  
        Dim columnsLength As Integer = (Me.gridInstance.MasterTableView.Columns.Count + Me.gridInstance.MasterTableView.AutoGeneratedColumns.Length)  
        Dim columnOrder() As Pair = CType(gridSettings(2), Pair())  
        If (columnsLength = columnOrder.Length) Then  
            Dim allColumns As ArrayList = New ArrayList(columnsLength)  
            allColumns.AddRange(Me.gridInstance.MasterTableView.Columns)  
            allColumns.AddRange(Me.gridInstance.MasterTableView.AutoGeneratedColumns)  
            Dim i As Integer = 0 
            For Each column As GridColumn In allColumns  
                column.OrderIndex = CType(columnOrder(i).First, Integer)  
                column.HeaderStyle.Width = CType(columnOrder(i).Second, Unit)  
                i = (i + 1)  
            Next  
        End If  
        'Load filter expression  
        Me.gridInstance.MasterTableView.FilterExpression = CType(gridSettings(3), String)  
    End Sub  
 
 
 
 
End Class  
 
<Serializable()> Public Class Pet  
    Public Sub New()  
        ' default ctor required for serializer   
    End Sub  
 
    Private _names As New Hashtable()  
    Public Property Names() As Hashtable  
        Get  
            Return _names  
        End Get  
        Set(ByVal value As Hashtable)  
            _names = value 
        End Set  
    End Property  
 
 
    Public Sub SavePetNames(ByVal Grid As RadGrid, ByVal GridName As String)  
        Dim settings As New GridSettingsPersister(Grid)  
        Dim settingvalue As String = settings.SaveSettings()  
        _names(GridName) = settingvalue  
        '   _names.Add(GridName, settingvalue)  
    End Sub  
 
 
 
End Class  
 
 
 
 
 
 
'End Namespace 

.ascx file
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init  
        '   export.Visible = True 
        For Each c As Control In Me.Controls  
            If TypeOf c Is RadGrid Then  
                Dim settings As New GridSettingsPersister(c)  
                If Profile.Pet.Names.ContainsKey(functions.getunique(c)) Then  
                    settings.LoadSettings(Profile.Pet.Names(functions.getunique(c)).ToString())  
                End If  
            End If  
        Next  
 
    End Sub  
 
 
    Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)  
        MyBase.Render(writer)  
        For Each c As Control In Me.Controls  
            If TypeOf c Is RadGrid Then  
                Profile.Pet.SavePetNames(c, functions.getunique(c))  
            End If  
        Next  
    End Sub  
 
 
Protected Sub RadGrid1_GroupsChanging(ByVal source As Object, ByVal e As Telerik.Web.UI.GridGroupsChangingEventArgs) Handles RadGrid1.GroupsChanging  
'This doesn't work    
    '   Profile.Pet.SavePetNames(RadGrid1, functions.getunique(RadGrid1))  
 
    End Sub  
 
 

source
<telerik:RadAjaxManager   ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
</telerik:RadAjaxManager> 

Tsvetoslav
Telerik team
 answered on 09 Oct 2009
0 answers
106 views
hi....
i hav a table in sql database.I want keep track of the table if i do any updation and deletion in  that table.How can i do with the help of sql logs....
Harry
Top achievements
Rank 1
 asked on 09 Oct 2009
3 answers
137 views
Is it possible to get the changed value of readonly numeric text box during javascript processing on postback?
Tsvetoslav
Telerik team
 answered on 09 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?