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

Hello, and thanks ahead.

 

I am using RAD  ASP.NET AJAX  Q3 2009 NET 3.5
Visual Basic
Visual Studio 2008
 

I have an ASPX page with a RADGRID, a RADTABSTRIP, and a RADMULTIPAGE.

 

I have three pages in the multipage.

 

RADPAGEVIEW1  has a Form View

RADPAGEVIEW 2 has a Form View

RADPAGEVIEW 3 has a RADGRID

 

When the page loads, the first RADGRID acts as a master grid and when a user selects a row, all of the form views and the other RADGRIDS update perfectly. (Great product by the way.)

 

On RADPAGEVIEW 3 I have a button that opens a new window to add a record to a table. (It actually uploads an image to a folder and adds the details to the table. When the user has finished uploading the image, the SAVE button closes the window and refreshes the Parent with the Grids and Page Views. Using:


 Dim sbScript As New StringBuilder()  
        sbScript.Append("<script language=javascript>")  
        sbScript.Append("window.opener.document.forms[0].submit();")  
        sbScript.Append("self.close();")  
        sbScript.Append("</script>")  
        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "@@@@MyPopUpScript", sbScript.ToString(), False)

 

What I would like to do, is when the page with the Grid and Page Views reloads, I would like for the data to refresh using the current data without passing anything from the closing window. Basically I want to just refresh the data and have it redisplay showing the new inserted record.

 

I am hoping it can be something simple like during INIT and just refresh the page.

 

Thanks in advance.



Code that calls the popup window


 

Imports System.Data  
Imports System.Data.SqlClient  
Imports Telerik.Web.UI  
Imports System.CodeDom  
Imports System.Web  
 
Partial Class terminal  
    Inherits System.Web.UI.Page  
 
 
    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender  
        If RadGrid1.SelectedIndexes.Count = 0 Then 
            RadGrid1.SelectedIndexes.Add(0)  
        End If 
    End Sub 
 
    Protected Sub btn_AddVehicleImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_AddVehicleImage.Click  
        Dim IDProfilefleet As String = Request.QueryString("IDProfilefleet")  
        Dim IDProfileTerminal As String = Request.QueryString("IDProfileTerminal")  
        Dim IDProfileAccount As String = Request.QueryString("IDProfileAccount")  
        Dim IDVehicles As Label = CType(FormView2.FindControl("lbl_IDVeh"), Label)  
        Dim sbScript As New StringBuilder()  
 
        sbScript.Append("<script language='javascript'>")  
        sbScript.Append("window.open('")  
        sbScript.Append("../../imagemanager/imageupload.aspx?IDProfilefleet=" & IDProfilefleet & "&IDProfileTerminal=" & IDProfileTerminal & "&IDProfileAccount=" & IDProfileAccount & "&IDVehicles=" & IDVehicles.Text)  
        sbScript.Append("', 'CustomPopUp',")  
        sbScript.Append("'width=800, height=600, menubar=yes, resizable=yes');<")  
        sbScript.Append("/script>")  
 
        ' Make use ScriptManager to register the script  
        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "@@@@MyPopUpScript", sbScript.ToString(), False)  
 
 
    End Sub 
 
 
 
End Class 
 
 
 
 


Code tha closes the popup window and refreshes parent page

Imports System.Data  
Imports System.Data.SqlClient  
Imports Radactive.WebControls.ILoad  
Imports Radactive.WebControls.ILoad.Configuration  
 
Partial Public Class ImageUpload_Detail  
    Inherits System.Web.UI.Page  
 
 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
 
        hf_IDProfileTerminal.Text = Request.QueryString("IDProfileTerminal")  
        hf_IDProfileAccount.Text = Request.QueryString("IDProfileAccount")  
        hf_IDProfileFleet.Text = Request.QueryString("IDProfileFleet")  
        hf_IDVehicles.Text = Request.QueryString("IDVehicles")  
 
        If (Not Me.IsPostBack) Then 
            ' Setup the I-Load configuration  
 
            ' Setup the control internal code / title  
            Me.CF_ImageUpload.Configuration.InternalCode = Director.Ex_E_101_ILoad1_InternalCode  
            Me.CF_ImageUpload.Configuration.Title = "Image Upload" 
            ' Setup the lightbox window mode  
            Me.CF_ImageUpload.WindowMode = ILoadWindowMode.Lightbox  
            ' Create a new image definition and add it to the I-Load configuration  
            Dim definition1 As WebImageDefinition = New WebImageDefinition("Default", "Default")  
            Me.CF_ImageUpload.Configuration.WebImageDefinitions.Clear()  
            Me.CF_ImageUpload.Configuration.WebImageDefinitions.Add(definition1)  
 
 
            ' Automatic Image Resize (Image is resized proportianlly to a max size of 800x600)  
            Dim resize1 As WebImageResizeDefinition = New WebImageResizeDefinition("Thumbnail 1", "Image")  
            definition1.ResizeDefinitions.Add(resize1)  
            resize1.Mode = Radactive.WebControls.ILoad.Core.Drawing.ImageResizeMode.Adaptive  
            resize1.AdaptiveMaxSize = New System.Drawing.Size(800, 600)  
 
 
            ' Automatic thumbanil #2 (Adaptive 100x100)  
            Dim resize2 As WebImageResizeDefinition = New WebImageResizeDefinition("Thumbnail 2", "Thumb")  
            definition1.ResizeDefinitions.Add(resize2)  
            resize2.Mode = Radactive.WebControls.ILoad.Core.Drawing.ImageResizeMode.Adaptive  
            resize2.AdaptiveMaxSize = New System.Drawing.Size(100, 100)  
 
 
 
            ' Initialization  
            If (Not String.IsNullOrEmpty(Request.QueryString("IDImages"))) Then 
                ' UPDATE...  
 
 
 
                ' Load the database data  
                Using connection As SqlConnection = Director.GetNewOpenDbConnection()  
                    Using command As SqlCommand = connection.CreateCommand()  
                        command.CommandType = CommandType.Text  
                        command.CommandText = "SELECT [Title, FileName, ThumbnailName] FROM [CF_Images] WHERE [IDImages]=@IDImages" 
                        command.Parameters.AddWithValue("@Id", Me.RecordId)  
 
                        Using reader As SqlDataReader = command.ExecuteReader()  
                            If (reader.Read()) Then 
                                ' Record found  
 
 
                                Me.txtTitle.Text = Convert.ToString(reader("Title"))  
                            Else 
                                ' Record not found, return to list  
                                Response.Redirect("images.aspx", True)  
                                Return 
                            End If 
                        End Using  
                    End Using  
                End Using  
 
                ' Get the imageId  
                Dim imageId As String = Me.RecordId.ToString()  
 
                ' Check if Picture1 exists  
                If (WebImage.ExistsInFileSystem(Director.ImageRepositoryFolder, imageId)) Then 
                    ' Picture1 found...  
 
                    ' Load picture1  
                    Me.CF_ImageUpload.Value = WebImage.LoadFromFileSystem(Director.ImageRepositoryFolder, imageId)  
                End If 
            Else 
                ' INSERT...  
 
                Me.RecordId = 0  
 
 
            End If 
        End If 
 
    End Sub 
 
    ' Gets or sets the record id  
    Public Property RecordId() As Integer 
        Get 
            If (Not (Me.ViewState("RecordId") Is Nothing)) Then 
                Return DirectCast(Me.ViewState("RecordId"), Integer)  
            Else 
                Return 0  
            End If 
        End Get 
        Set(ByVal value As Integer)  
            Me.ViewState("RecordId") = value  
        End Set 
    End Property 
 
    Protected Sub cancelButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)  
        ' Cancel - Return to list  
        Response.Redirect("imageupload.aspx")  
    End Sub 
 
    Protected Sub saveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveButton.Click  
        ' Save the record  
        ' Validate   
        If (Not Me.IsValid) Then 
            Return 
        End If 
 
        If (Me.RecordId <> 0) Then 
            ' UPDATE...  
 
            Using connection As SqlConnection = Director.GetNewOpenDbConnection()  
                ' Update the record  
                Using command As SqlCommand = connection.CreateCommand()  
                    command.CommandType = CommandType.Text  
                    command.CommandText = "UPDATE [CF_Images] SET [Title]=@Title WHERE [IDImages]=@IDImages" 
                    command.Parameters.AddWithValue("@Title", Me.txtTitle.Text)  
                    command.Parameters.AddWithValue("@IDImages", Me.RecordId)  
 
                    command.ExecuteNonQuery()  
                End Using  
            End Using  
        Else 
            ' INSERT...  
 
            Using connection As SqlConnection = Director.GetNewOpenDbConnection()  
                ' Insert the new record  
                Using command As SqlCommand = connection.CreateCommand()  
                    command.CommandType = CommandType.Text  
                    command.CommandText = "INSERT INTO [CF_Images] ([Title]) VALUES (@Title)" 
                    command.Parameters.AddWithValue("@Title", Me.txtTitle.Text)  
 
                    command.ExecuteNonQuery()  
                End Using  
 
                ' Get the new record id  
                Using command As SqlCommand = connection.CreateCommand()  
                    command.CommandType = CommandType.Text  
                    command.CommandText = "SELECT @@IDENTITY" 
 
                    Me.RecordId = Convert.ToInt32(command.ExecuteScalar())  
                End Using  
            End Using  
        End If 
 
        ' Get the image id  
        Dim imageId As String = Me.RecordId.ToString()  
 
        ' Update image files in the file system  
        'WebImage.SynchronizeFileSystem(Me.picture1.Value, Director.ImageRepositoryFolder, imageId)  
        Me.CF_ImageUpload.SynchronizeFileSystem(Director.ImageRepositoryFolder, imageId)  
 
        ' Get the file names ---------------------------------------------------  
        Dim selectedImage_FileName As String 
        Dim thumbnail1_FileName As String 
        Dim thumbnail2_FileName As String 
        Dim UserID As String 
        Dim IDProfileTerminal As String 
        Dim IDProfileAccount As String 
        Dim IDProfileFleet As String 
        Dim IDVehicles As String 
 
 
 
        If (Not (CF_ImageUpload.Value Is Nothing)) Then 
            ' An image has been selected...  
            thumbnail1_FileName = CF_ImageUpload.Value.Resizes("Image").FileName  
            thumbnail2_FileName = CF_ImageUpload.Value.Resizes("Thumb").FileName  
            UserID = Session("UserID")  
            IDProfileTerminal = Request.QueryString("IDProfileTerminal")  
            IDProfileAccount = Request.QueryString("IDProfileAccount")  
            IDProfileFleet = Request.QueryString("IDProfileFleet")  
            IDVehicles = Request.QueryString("IDVehicles")  
 
        Else 
            ' No image selected  
            selectedImage_FileName = "" 
            thumbnail1_FileName = "" 
            thumbnail2_FileName = "" 
            UserID = "" 
            IDProfileTerminal = "" 
            IDProfileAccount = "" 
            IDProfileFleet = "" 
            IDVehicles = "" 
        End If 
        '----------------------------------------------------------------------  
 
        ' Save the file names -------------------------------------------------  
        Using connection As SqlConnection = Director.GetNewOpenDbConnection()  
            ' Update the record  
            Using command As SqlCommand = connection.CreateCommand()  
                command.CommandType = CommandType.Text  
                command.CommandText = "UPDATE [CF_Images] SET [FileName]=@thumbnail1_FileName, [ThumbnailName]=@thumbnail2_FileName, [UserID]=@UserID, [IDModifiedUser]=@IDModifiedUser, [IDProfileTerminal]=@IDProfileTerminal, [IDProfileAccount]=@IDProfileAccount, [IDProfileFleet]=@IDProfileFleet, [IDVehicles]=@IDVehicles WHERE [IDImages]=@IDImages" 
                command.Parameters.AddWithValue("@thumbnail1_FileName", thumbnail1_FileName)  
                command.Parameters.AddWithValue("@thumbnail2_FileName", thumbnail2_FileName)  
                command.Parameters.AddWithValue("@IDImages", Me.RecordId)  
                command.Parameters.AddWithValue("@UserID", UserID)  
                command.Parameters.AddWithValue("@IDModifiedUser", UserID)  
                command.Parameters.AddWithValue("@IDProfileTerminal", IDProfileTerminal)  
                command.Parameters.AddWithValue("@IDProfileAccount", IDProfileAccount)  
                command.Parameters.AddWithValue("@IDProfileFleet", IDProfileFleet)  
                command.Parameters.AddWithValue("@IDVehicles", IDVehicles)  
                command.ExecuteNonQuery()  
            End Using  
        End Using  
        '----------------------------------------------------------------------  
 
        ' All done - Return to list  
        Dim sbScript As New StringBuilder()  
        sbScript.Append("<script language=javascript>")  
        sbScript.Append("window.opener.document.forms[0].submit();")  
        sbScript.Append("self.close();")  
        sbScript.Append("</script>")  
        ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "@@@@MyPopUpScript", sbScript.ToString(), False)  
 
 
    End Sub 
 
    Protected Sub CF_ImageUpload_ValueChanged(ByVal sender As Object, ByVal e As Radactive.WebControls.ILoad.ILoadValueChangedEventArgs) Handles CF_ImageUpload.ValueChanged  
 
    End Sub 
 
End Class 
 
 
 

Martin
Telerik team
 answered on 08 Apr 2010
3 answers
89 views
I'm in the midst of ensuring XHTML compliance against the validator at: http://validator.w3.org (the definitive validator IMHO).

The following is being correctly identifed as being invalid:

<div id="ctl00_MainContent_AlertsCardGrid" class="RadGrid RadGrid_Office2007">
<!-- 2009.3.1314.35 --><table cellspacing="0" accesskey="T" . . .



Access key is NOT VALID on a <table> element.

I have done a workaround for this issue by using a <a> element. One possible correct solution is shown below


<div id="ctl00_MainContent_AlertsCardGrid" class="RadGrid RadGrid_Office2007"> <!-- 2009.4.1914.35 --><a accesskey="T" name="AccountSummaryGrid"></a>
<table cellspacing="0" . . .




This issue is in other Telerik Controls (and rampant in Microsoft's AspNet Control!)
"

The following elements support the accesskey attribute: A, AREA, BUTTON, INPUT, LABEL, and LEGEND, and TEXTAREA."
from http://www.w3.org/TR/html401/interact/forms.html#h-17.11.2. Placing it on ANY OTHER ELEMENTS will cause the page to fail validation.







Dimo
Telerik team
 answered on 08 Apr 2010
2 answers
85 views
I all,

I have a custom javascript function in the MOSSEditorTools.js file and it used to work fine. But since I've upgraded to the V5.7.1.0 version I'm having a javascript error saying OnClientPasteHtml is undefined...

When I check the source, the page is referencing the MOSSEditorTools.js at the right location (/_wpresources/RadEditorSharePoint/5.7.1.0__1f131a624888eeed/Resources/MOSSEditorTools.js) and the MOSSEditorTools.js does contain my custom function.

What am I missing ?!
Sébastien Nunes
Top achievements
Rank 1
 answered on 08 Apr 2010
1 answer
130 views

Requirements

RadControls version

Q3 2008

.NET version

3.5

Visual Studio version

2008 SP1

programming language

C#

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION 
Allow user drag-drop columns in grid. Then reorder columns in grid.  The columns should be reordered on the server-side. When the columns are reordered it will save the new order to the CustomColumns table in Sequence field.
Yavor
Telerik team
 answered on 08 Apr 2010
1 answer
154 views
Hi,

Due to certain constraints, I am required to have AjaxUpdatePanel and RadAjaxLoadingPanel. Is it possible to show a loading image as in the attachement. My requirement is that, when an request happens, the loading image must appear, and during this time, the user should not be allowed to click any other controls in the page.

Thanks
Sarvanan
Princy
Top achievements
Rank 2
 answered on 08 Apr 2010
1 answer
248 views

I have a RadGrid that puts all rows in to editmode when the page loads, as outlined in the documentation using the PreRender event.  I have also configured an UpdateAll item command to enable updating all records at once, as outlined in "Performing Batch Updates".  The problem is that it updates all records even if no change was made.  Is there someway to mark a row as dirty and only run the update query if it has changed?
Any suggestions on how I can limit the update to only fire if a change to the row was made?

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand  
        If e.CommandName = "UpdateAll" Then 
            For Each editedItem As GridEditableItem In RadGrid1.EditItems  
                Dim newValues As Hashtable = New Hashtable  
                e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem)  
                sdsSODetails.UpdateCommand = String.Format("UPDATE rx_srorder_extend SET STOP_NO='{0}', PLAN_REC_DATE='{1}', CONF_REC_DATE='{2}', CONF_NO='{3}', CONF_BY='{4}', CHANGED_BY='{6}' WHERE SRORDER_ID='{7}' IF @@ROWCOUNT = 0 INSERT INTO rx_srorder_extend (SRORDER_ID, PLAN_REC_DATE, CONF_REC_DATE, CONF_NO, CONF_BY, STOP_NO, CHANGED_BY) VALUES ('{7}', '{1}','{2}','{3}','{4}','{0}','{6}')", newValues("STOP_NO"), newValues("PLAN_REC_DATE"), newValues("CONF_REC_DATE"), newValues("CONF_NO"), newValues("CONF_BY"), newValues("SCHED_STATUS_ID"), newValues("CHANGED_BY"), editedItem.GetDataKeyValue("SRORDER_ID").ToString())  
               sdsSODetails.Update()  
            Next 
        End If 
    End Sub 
 
    Private Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender  
        If Not IsPostBack Then 
            For Each item As GridItem In RadGrid1.MasterTableView.Items  
                If TypeOf item Is GridEditableItem Then 
                    Dim editableItem As GridEditableItem = CType(item, GridDataItem)  
                    editableItem.Edit = True 
                End If 
            Next 
            RadGrid1.Rebind()  
        End If 
    End Sub 
 
Princy
Top achievements
Rank 2
 answered on 08 Apr 2010
1 answer
83 views
I am using RadTextBox, RadNumericTextBox and RadMaskedTextBox with Skin="" and using RadFormDecorator to create rounded corners in accordance with your recommendation.
When I apply CssClass AlignRight { text-align:right; } the rounded corners disappear.
How else can this be done?
Regards
Harry
Dimo
Telerik team
 answered on 08 Apr 2010
2 answers
76 views
can we customize radmenu whose skin is windows 7. ?
Soumya Joseph
Top achievements
Rank 1
 answered on 08 Apr 2010
1 answer
77 views
I am looking for some advice on valid techniques for updating a column in a grid asynchronously with sort of notification. Here's the scoop...

I have a list of vendors in a grid (measured in the thousands). I want the ability to multi-select vendors and then kick off a task which verifies them via a server-side task. So, lets say that I select 20 vendors through multi-select. Then I click a "verify" button. I want this to initiate a task on the server which does the following:

. Sends the 20 rows to a server-side method (let's call it "ValidateRows")
. As ValidateRows iterates through the list I want the selected columns (in the grid) to initially show an hourglass or something.
. As the validity of any one row is determined the status changes visually in the grid
. Note that the per-row verification is not necessarily a quick thing (could take, say, 15-20 seconds each)
. I want the verifications to occur in parallel, rather than serialized, up to a maximum "thread count". So, if I send 20 rows maybe a thread count of 10 would mean that 10 are being checked at any one time.
. I don't want some server-side "service" waiting for all this. I want the verification task (the one that iterates through the sent rows on the server) to be initiated on demand.

Obviously Ajax looks like a good choice in terms of the visual treatment (in the grid) but I am not sure of the techniques I should use for the other elements of this.

I welcome any suggestions.

Thanks.

Mark
Mira
Telerik team
 answered on 08 Apr 2010
1 answer
128 views
Hi,
I have 2 radcombox, RadComboBox A and  RadComboBox B which the data in RadComboBox B is decided by the selection in RadCombobox A. Both the RadCombobox is in RadGrid.
When the grid go into  "Add Record "mode , i fail to populate the data in RadComboBox B for the first item in RadComboBox A.My coding is as below :

  <ajax:RadComboBox runat="server" ID="RadComboA" DataSource="<%# getApp() %>"  OnSelectedIndexChanged="BindSecondCombo" 
                    DataTextField="Selection"  AutoPostBack ="true" 
                    DataValueField="AppId"  
                    SelectedValue='<%# DataBinder.Eval(Container.DataItem, "AppId") %>'></ajax:RadComboBox> 
                    






Public Sub BindSecondCombo(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) 
 
        Dim radComboA As RadComboBox 
        Dim radComboB As RadComboBox 
        Dim editItem As GridDataInsertItem 
 
 
        radComboA = CType(sender, RadComboBox) 
        editItem = CType(radCombo1.NamingContainer, GridDataInsertItem) 
 
 
 
        radComboB = CType(editItem.FindControl("radComboB"), RadComboBox) 
 
        If radComboB Is Nothing = False Then 
            radComboB.ClearSelection() 
            radComboB.DataSource = getRecordByType(7, radComboA.SelectedValue, "", "", "", "", "") 
            radComboB.DataTextField = "modulename" 
            radComboB.DataValueField = "moduleid" 
            radComboB.DataBind() 
        
        End If 
 
 
    End Sub 




My coding work fine only when the RadGrid go into "Add Record " mode, no selection has been done on RadComboBox A, it fail to populate the data to RaCombobox B based on the first item in  RaCombobox A.
Does anyone has idea on populate the data in  RadComboBox B based on the first item in RadComboBox A  when RadGrid go into "Add Record" mode?
Shinu
Top achievements
Rank 2
 answered on 08 Apr 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?