Dec 18, 2011, 5:34 PM
[CLOSED] Will FileUpload control works with Editable Grid Panel?
Hi,
In a specific scenario I need to show fileupload control in a editable grid and the selected files should upload while saving. I have added file upload control in editable grid at column 2. I don't know why this control showing like smaller textfiled and bigger "Browse..." button and also no attachment icon showing. I need the functionality like selected files to upload at respective places. Editable grid not even recognizing the file selected. Please have a look at sample code...
In a specific scenario I need to show fileupload control in a editable grid and the selected files should upload while saving. I have added file upload control in editable grid at column 2. I don't know why this control showing like smaller textfiled and bigger "Browse..." button and also no attachment icon showing. I need the functionality like selected files to upload at respective places. Editable grid not even recognizing the file selected. Please have a look at sample code...
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ExtCheckEditableGridUploadControls.aspx.vb"
Inherits="Testing_ExtCheckEditableGridUploadControls" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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">
<title></title>
<link href="../css/examples.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="resMngr" runat="server" />
<ext:Store ID="StoreConditions" runat="server" OnBeforeStoreChanged="Store_BeforeStoreChanged">
<Reader>
<ext:JsonReader IDProperty="CONDITION_ID">
<Fields>
<ext:RecordField Name="CONDITION_ID" />
<ext:RecordField Name="CONDITION" />
<ext:RecordField Name="UPLOADFILE" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Viewport ID="Viewport1" runat="server" Layout="Border">
<Items>
<ext:TabPanel ID="pnlbackground" runat="server" Region="Center" Border="false">
<Items>
<ext:Panel ID="pnlDocuments" Title="Documents" runat="server" BodyStyle="background-color:#ffffff"
Border="false" Layout="CardLayout" ActiveIndex="0">
<Items>
<ext:Panel ID="pnlDocsCommon" runat="server" Border="false" Region="Center" Layout="BorderLayout"
BodyStyle="background-color:#ffffff">
<Items>
<ext:GridPanel ID="GridPanel1" runat="server" Region="Center" StoreID="StoreConditions">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column Header="Condition" DataIndex="CONDITION">
</ext:Column>
<ext:Column Header="Upload File">
<Editor>
<ext:FileUploadField ID="ufield" runat="server" Icon="Attach">
</ext:FileUploadField>
</Editor>
</ext:Column>
<ext:CommandColumn Width="40">
<Commands>
<ext:GridCommand Text="Reject" ToolTip-Text="Reject row changes" CommandName="taskreject"
Icon="ArrowUndo" />
</Commands>
<PrepareToolbar Handler="toolbar.items.get(0).setVisible(record.dirty);" />
</ext:CommandColumn>
</Columns>
</ColumnModel>
<Listeners>
<Command Handler="record.reject();" />
</Listeners>
<Plugins>
<ext:EditableGrid ID="EditableGrid1" runat="server" />
</Plugins>
<View>
<ext:GridView ID="GridView1" runat="server" ForceFit="true" />
</View>
</ext:GridPanel>
</Items>
<Buttons>
<ext:Button ID="btnSaveCondChanges" runat="server" Text="Save">
<Listeners>
<Click Handler="GridPanel1.save();" Delay="10" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:TabPanel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
code behind...
Imports Ext.Net
Partial Class Testing_ExtCheckEditableGridUploadControls
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Ext.Net.X.IsAjaxRequest Then
Call LoadAllStoreInfo()
End If
End Sub
Public Sub LoadAllStoreInfo()
StoreConditions.DataSource = GetAllConditions()
StoreConditions.DataBind()
End Sub
Public Function GetAllConditions() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
Dim i As Integer
dt.Columns.Add("CONDITION_ID")
dt.Columns.Add("CONDITION")
dt.Columns.Add("UPLOADFILE")
For i = 0 To 10
dr = dt.NewRow()
dr(0) = i + 1
dr(1) = "Condition " & i.ToString()
dr(2) = ""
dt.Rows.Add(dr)
Next
Return dt
End Function
Public Sub Store_BeforeStoreChanged(ByVal sender As Object, ByVal e As BeforeStoreChangedEventArgs)
Dim jsonData As String = e.DataHandler.JsonData
Ext.Net.X.Msg.Alert("Saved", jsonData).Show()
End Sub
End Class
Last edited by Daniil; Dec 26, 2011 at 11:22 AM.
Reason: [CLOSED]