Hello,
I'm using the RadGrid control in order to insert, update and delete records (using UserControl, see demo).
I have a problem here:
I have to upload files by inserting new records, edit the files by editing the record and remove the files by deleting the record.
I want to indicate again, the RadGrid using usercontrol .
Please, I need your help,
It is appreciated to send a sample code.
Regards,
Bader
I'm using the RadGrid control in order to insert, update and delete records (using UserControl, see demo).
I have a problem here:
I have to upload files by inserting new records, edit the files by editing the record and remove the files by deleting the record.
I want to indicate again, the RadGrid using usercontrol .
Please, I need your help,
It is appreciated to send a sample code.
Regards,
Bader
3 Answers, 1 is accepted
0
Hello Bader,
You could take a look at the following forum threads discussing the same scenario, they should help you get it working:
http://www.telerik.com/community/forums/aspnet-ajax/upload/file-to-upload-count-0-when-i-have-the-radupload-as-custom-radgrid-addedit-control.aspx (contains a sample project)
http://www.telerik.com/community/forums/aspnet-ajax/upload/radupload-in-webusercontrol-radgrid.aspx
http://www.telerik.com/community/forums/aspnet-ajax/upload/upload-in-dynamically-loaded-user-control.aspx
If you do a search on the forums, more threads will come up dealing with problems related to such set up.
Greetings,
Tsvetina
the Telerik team
You could take a look at the following forum threads discussing the same scenario, they should help you get it working:
http://www.telerik.com/community/forums/aspnet-ajax/upload/file-to-upload-count-0-when-i-have-the-radupload-as-custom-radgrid-addedit-control.aspx (contains a sample project)
http://www.telerik.com/community/forums/aspnet-ajax/upload/radupload-in-webusercontrol-radgrid.aspx
http://www.telerik.com/community/forums/aspnet-ajax/upload/upload-in-dynamically-loaded-user-control.aspx
If you do a search on the forums, more threads will come up dealing with problems related to such set up.
Greetings,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Bader
Top achievements
Rank 1
answered on 17 Aug 2011, 09:39 AM
Hello,
Thank you very much for your reply,I still have a problem,
Here is my code:
user control code:
user control c# code:
The above code checks the number of the attched images and if there is at least one image (file), it saves its FileName, but unfortunatily the return result is "No images are attached", thats mean, that even if I attach an image, the code doesn't read it.
Please, I need your help in order to solve the above problem,
It is appreciated to send me the modified code.
Regards,
Bader
Thank you very much for your reply,I still have a problem,
Here is my code:
<%@ Page Title="" Language="C#" MasterPageFile="~/SecureSiteManagenment/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="SecureSiteManagenment_SecureSQLServer_ItemsMng_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
Runat
=
"Server"
>
<
style
type
=
"text/css"
>
.EditFormHeader td
{
background: white;
padding: 5px 0px;
}
</
style
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
Runat
=
"Server"
>
<
table
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"100%"
>
<
tr
>
<
td
style
=
"padding-right:5px;"
colspan
=
"3"
align
=
"right"
>
<
asp:Label
ID
=
"ItemsMngHeaderLabel"
runat
=
"server"
SkinID
=
"HeaderText"
Text="<%$ Resources:Resource, SItemsMngHeaderLabel %>" ></
asp:Label
><
br
/><
br
/>
</
td
>
</
tr
>
</
table
>
<
br
/>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
//On insert and update buttons click temporarily disables ajax to perform upload actions
function conditionalPostback(sender, args) {
var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
if (args.get_eventTarget().indexOf("btnUpdate") != -1) {
var upload = $find(window['UploadId']);
//AJAX is disabled only if file is selected for upload
if (upload.getFileInputs()[0].value != "") {
args.set_enableAjax(false);
}
}
}
</
script
>
</
telerik:RadScriptBlock
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
clientevents-onrequeststart
=
"conditionalPostback"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
GridLines
=
"None"
AllowPaging
=
"True"
CssClass
=
"RadGrid"
style
=
"z-index:10000000000;"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
ShowStatusBar
=
"true"
OnPreRender
=
"RadGrid1_PreRender"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
OnUpdateCommand
=
"RadGrid1_UpdateCommand"
AllowFilteringByColumn
=
"true"
OnInsertCommand
=
"RadGrid1_InsertCommand"
OnDeleteCommand
=
"RadGrid1_DeleteCommand"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
>
<
MasterTableView
Width
=
"100%"
CommandItemDisplay
=
"Top"
Dir
=
"RTL"
DataKeyNames
=
"ItemID"
>
<
Columns
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditCommandColumn1"
EditText="<%$ Resources:Resource, TelerikRadGridEditColumnText %>">
</
telerik:GridEditCommandColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"FileUrl"
AllowFiltering
=
"false"
HeaderText="<%$ Resources:Resource, SItemsMngRadGridColumnFileUrl %>" DataField="FileUrl">
<
ItemTemplate
>
<
asp:Image
ID
=
"FileUrlImage"
Width
=
"40px"
Height
=
"40px"
ImageUrl='<%# (DataBinder.Eval( Container, "DataItem.FileUrl" ).ToString().Equals(string.Empty)) ? "~/Pages/Design/Imgs/Itms/NoItem.jpg" : (string.Format("~/Pages/Design/WriteOnImage/CreateBImg.aspx?fileUrl={0}&
typ
=
small
", DataBinder.Eval( Container, "DataItem.FileUrl" ).ToString().Replace("~/","").Replace("/","-"))) %>' runat="server" />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ItemID"
HeaderText="<%$ Resources:Resource, SItemsMngRadGridColumnItemID %>" DataField="ItemID">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ItmName"
HeaderText="<%$ Resources:Resource, SItemsMngRadGridColumnItmName %>" DataField="ItmName">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"FileUrl"
HeaderText="<%$ Resources:Resource, SItemsMngRadGridColumnFileUrl %>" DataField="FileUrl">
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
UniqueName
=
"ViewItm"
HeaderText="<%$ Resources:Resource, SItemsMngRadGridColumnViewItm %>" DataField="ViewItm">
</
telerik:GridCheckBoxColumn
>
<
telerik:GridButtonColumn
UniqueName
=
"DeleteColumn"
Text="<%$ Resources:Resource, TelerikRadGridDeleteColumnText %>" CommandName="Delete" />
</
Columns
>
<
EditFormSettings
UserControlName
=
"~/SecureSiteManagenment/SecureSQLServer/ItemsMng/ItemsMngSubUserControl.ascx"
EditFormType
=
"WebUserControl"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
</
asp:Content
>
protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
if (!Convert.ToString((userControl.FindControl("MainCatgryRadComboBox") as RadComboBox).SelectedItem.Text).Equals(Resources.Resource.SecureSecureSQLServerItemsMngMainCtgryFirstItemText.ToString()))
{
//Create new row in the DataSource
DataRow newRow = this.ItmsLstDataTable.NewRow();
//Insert new values
Hashtable newValues = new Hashtable();
RadUpload upload = userControl.FindControl("ItmImgRadUpload") as RadUpload;
int filesCount = upload.UploadedFiles.Count;
newValues["ItmName"] = Convert.ToString((userControl.FindControl("ItmNameRadTextBox") as RadTextBox).Text);
newValues["MainCtgry"] = Convert.ToString((userControl.FindControl("MainCatgryRadComboBox") as RadComboBox).SelectedItem.Text);
newValues["SubCtgry"] = Convert.ToString((userControl.FindControl("SubCtgryRadComboBox") as RadComboBox).SelectedItem.Text);
newValues["ViewItm"] = Convert.ToBoolean((userControl.FindControl("ViewItmRadComboBox") as RadComboBox).SelectedValue);
newValues["Title"] = Convert.ToString((userControl.FindControl("TitleRadTextBox") as RadTextBox).Text);
newValues["ItmDesc"] = Convert.ToString((userControl.FindControl("ItmDescRadTextBox") as RadTextBox).Text);
newValues["ItmBigDesc"] = Convert.ToString((userControl.FindControl("ItmBigDescRadEditor") as RadEditor).Content);
newValues["ItemPrice"] = Convert.ToInt32((userControl.FindControl("ItemPriceRadNumericTextBox") as RadNumericTextBox).Value);
newValues["ViewPrice"] = Convert.ToBoolean((userControl.FindControl("ViewPriceRadComboBox") as RadComboBox).SelectedValue);
newValues["ViewImg"] = Convert.ToBoolean((userControl.FindControl("ViewImgRadComboBox") as RadComboBox).SelectedValue);
newValues["ViewItmBigDesc"] = Convert.ToBoolean((userControl.FindControl("ViewItmBigDescRadComboBox") as RadComboBox).SelectedValue);
newValues["FileUrl"] = (filesCount > 0) ? Convert.ToString(upload.UploadedFiles[0].FileName) : "No images are attached";
newValues["LstUpdBy"] = Convert.ToInt64(LoggedOnUserID);
//Label1.Text = upload.UploadedFiles[0].FileName;
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["TmonavotConnectionString"]);
SqlCommand cmd = new SqlCommand("ItmsLst_ManagenmentOperations", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ItemID", SqlDbType.BigInt, 8);
cmd.Parameters.Add("@ItmName", SqlDbType.NVarChar, 100);
cmd.Parameters.Add("@MainCtgry", SqlDbType.NVarChar, 300);
cmd.Parameters.Add("@SubCtgry", SqlDbType.NVarChar, 300);
cmd.Parameters.Add("@ESubCtgry", SqlDbType.NVarChar, 300);
cmd.Parameters.Add("@ViewItm", SqlDbType.Bit, 1);
cmd.Parameters.Add("@LstUpdBy", SqlDbType.BigInt, 8);
cmd.Parameters.Add("@Title", SqlDbType.NVarChar, 500);
cmd.Parameters.Add("@ItmDesc", SqlDbType.NVarChar, 4000);
cmd.Parameters.Add("@ItmBigDesc", SqlDbType.NText);
cmd.Parameters.Add("@ItemPrice", SqlDbType.Int, 4);
cmd.Parameters.Add("@ViewPrice", SqlDbType.Bit, 1);
cmd.Parameters.Add("@ViewImg", SqlDbType.Bit, 1);
cmd.Parameters.Add("@ViewItmBigDesc", SqlDbType.Bit, 1);
cmd.Parameters.Add("@FileUrl", SqlDbType.NVarChar, 500);
cmd.Parameters.Add("@OutputID", SqlDbType.BigInt, 8);
cmd.Parameters.Add("@OprType", SqlDbType.NChar, 10);
cmd.Parameters[0].Value = DBNull.Value;
cmd.Parameters[1].Value = Convert.ToString((userControl.FindControl("ItmNameRadTextBox") as RadTextBox).Text);
cmd.Parameters[2].Value = Convert.ToString((userControl.FindControl("MainCatgryRadComboBox") as RadComboBox).SelectedItem.Text);
cmd.Parameters[3].Value = Convert.ToString((userControl.FindControl("SubCtgryRadComboBox") as RadComboBox).SelectedItem.Text);
cmd.Parameters[4].Value = Convert.ToString((userControl.FindControl("MainCatgryRadComboBox") as RadComboBox).SelectedValue);
cmd.Parameters[5].Value = Convert.ToBoolean((userControl.FindControl("ViewItmRadComboBox") as RadComboBox).SelectedValue);
cmd.Parameters[6].Value = Convert.ToInt64(LoggedOnUserID);
cmd.Parameters[7].Value = Convert.ToString((userControl.FindControl("TitleRadTextBox") as RadTextBox).Text);
cmd.Parameters[8].Value = Convert.ToString((userControl.FindControl("ItmDescRadTextBox") as RadTextBox).Text);
cmd.Parameters[9].Value = Convert.ToString((userControl.FindControl("ItmBigDescRadEditor") as RadEditor).Content);
cmd.Parameters[10].Value = Convert.ToInt32((userControl.FindControl("ItemPriceRadNumericTextBox") as RadNumericTextBox).Value);
cmd.Parameters[11].Value = Convert.ToBoolean((userControl.FindControl("ViewPriceRadComboBox") as RadComboBox).SelectedValue);
cmd.Parameters[12].Value = Convert.ToBoolean((userControl.FindControl("ViewImgRadComboBox") as RadComboBox).SelectedValue);
cmd.Parameters[13].Value = Convert.ToBoolean((userControl.FindControl("ViewItmBigDescRadComboBox") as RadComboBox).SelectedValue);
cmd.Parameters[14].Value = (filesCount > 0) ? Convert.ToString(upload.UploadedFiles[0].FileName) : "No images are attached";
cmd.Parameters[15].Direction = ParameterDirection.Output;
cmd.Parameters[16].Value = "Insert";
try
{
conn.Open();
cmd.ExecuteNonQuery();
}
catch
{
conn.Close();
return;
}
conn.Close();
//make sure that unique primary key value is generated for the inserted row
if (Convert.ToInt64(ItmsLstDataTable.Rows.Count) == 0)
{
newValues["ItemID"] = Convert.ToInt64(cmd.Parameters[15].Value);
}
else
{
newValues["ItemID"] = (long)this.ItmsLstDataTable.Rows[this.ItmsLstDataTable.Rows.Count - 1]["ItemID"] + 1;
}
try
{
foreach (DictionaryEntry entry in newValues)
{
newRow[(string)entry.Key] = entry.Value;
}
this.ItmsLstDataTable.Rows.Add(newRow);
this.ItmsLstDataTable.AcceptChanges();
}
catch (Exception ex)
{
Label lblError = new Label();
lblError.Text = "Unable to insert ItmsLst. Reason: " + ex.Message;
lblError.ForeColor = System.Drawing.Color.Red;
RadGrid1.Controls.Add(lblError);
e.Canceled = true;
}
}
else
{
RadGrid1.Controls.Add(new LiteralControl(Resources.Resource.SecureSecureSQLServerItemsMngInsertOperationFaild.ToString()));
e.Canceled = false;
}
}
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
RadUpload upload = userControl.FindControl("ItmImgRadUpload") as RadUpload;
RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", upload.ClientID));
}
}
user control code:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ItemsMngSubUserControl.ascx.cs" Inherits="ItemsMngSubUserControl" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register src="~/SecureSiteManagenment/SecureSQLServer/Common/UserControls/JointUserControls/FileUrlUserControl/FileUrlFileSelectorUserControl.ascx" tagname="FileUrlFileSelectorUserControl" tagprefix="uc1" %>
<
link
rel
=
"stylesheet"
type
=
"text/css"
href
=
"../../../Common/Controls/RadEditor/RTLRadEditorStyle/Editor_RTL.css"
/>
<
style
type
=
"text/css"
>
.RightColumn
{
width:150px;
}
.LeftColumn
{
width:802px;
}
html
{
direction: rtl;
}
html, body, form
{
height: 100%;
margin: 0px;
padding: 0px;
}
/*info panel*/
.infoPanel,
.bigModule
{
border:1px solid #ffe58a;
margin:1.6em 0;
padding:1em 3em 1em 0;
background:#fff3c8 repeat-x url(../../../Common/styles09/infoPanel.gif);
color:#000;
}
.infoInner,
.bigModuleBottom
{
min-height:30px;
padding:0 0 0 66px;
background:no-repeat -1184px -1447px url(../../../Common/styles09/sprite09.gif);
}
.infoPanel .title,
.bigModule .title
{
display:block;
margin:0 0 1.4em;
padding:6px 0 0;
font-size:1.2em;
}
.infoPanel a,
.bigModule a
{
color:#f60;
}
</
style
>
<
div
style
=
"margin:10px;"
>
<
table
id
=
"Table2"
cellspacing
=
"2"
cellpadding
=
"1"
width
=
"100%"
border
=
"1"
rules
=
"none"
style
=
"BORDER-COLLAPSE: collapse"
>
<
tr
align
=
"right"
>
<
td
colspan
=
"2"
>
<
b
></
b
></
td
>
</
tr
>
<
tr
align
=
"right"
>
<
td
>
<
table
id
=
"Table3"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
>
<
tr
>
<
td
colspan
=
"2"
></
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ItmNameLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlItmNameLabel %>" ></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadTextBox
ID
=
"ItmNameRadTextBox"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.ItmName" ) %>' Width="201px" >
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
<
asp:Panel
ID
=
"CtgrsPanel"
runat
=
"server"
Width
=
"100%"
>
<
telerik:RadAjaxPanel
ID
=
"CtgRadAjaxPanel"
runat
=
"server"
>
<
table
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"100%"
>
<
tr
>
<
td
style
=
"width:151px;"
>
<
asp:Label
ID
=
"MainCtgryLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlMainCtgryLabel %>"></
asp:Label
>
</
td
>
<
td
style
=
"width:801px;"
>
<
asp:Panel
ID
=
"ddd"
Width
=
"100%"
runat
=
"server"
>
<
telerik:RadAjaxPanel
ID
=
"ssss"
runat
=
"server"
>
<
asp:XmlDataSource
ID
=
"MainCatgryXmlDataSource"
runat
=
"server"
DataFile
=
"~/Common/xml/HeaderMenu.xml"
XPath="Menu/Item[position() = 1 or position() >2]"></
asp:XmlDataSource
>
<
telerik:RadComboBox
ID
=
"MainCatgryRadComboBox"
Runat
=
"server"
DataSourceID
=
"MainCatgryXmlDataSource"
DataTextField
=
"IText"
EnableLoadOnDemand
=
"True"
AutoPostBack
=
"true"
OffsetX
=
"-30"
BorderColor
=
"Black"
BorderWidth
=
"1px"
HighlightTemplatedItems
=
"true"
Width
=
"205px"
Height
=
"150px"
DataValueField
=
"SubCtgry"
SelectedIndex='<%# (Convert.ToInt32(getMainCtgryIndexIndex(DataBinder.Eval( Container, "DataItem.MainCtgry" ).ToString().Trim()))) - 1 %>'
onselectedindexchanged="MainCatgryRadComboBox_SelectedIndexChanged" >
</
telerik:RadComboBox
>
<
asp:XmlDataSource
ID
=
"DefaultSubCategoryXmlDataSource"
runat
=
"server"
DataFile
=
"~/Common/xml/DefaultMenu.xml"
></
asp:XmlDataSource
>
<
asp:XmlDataSource
ID
=
"DfosSubCategoryXmlDataSource"
runat
=
"server"
DataFile
=
"~/Common/xml/DfosMenu.xml"
></
asp:XmlDataSource
>
<
asp:XmlDataSource
ID
=
"StudioSubCategoryXmlDataSource"
runat
=
"server"
DataFile
=
"~/Common/xml/StudioMenu.xml"
></
asp:XmlDataSource
>
<
asp:XmlDataSource
ID
=
"PrintingOnProductsSubCategoryXmlDataSource"
runat
=
"server"
DataFile
=
"~/Common/xml/PrintingOnProductsMenu.xml"
></
asp:XmlDataSource
>
<
asp:Label
ID
=
"MainCtgryDataLabel"
runat
=
"server"
Visible
=
"false"
Text='<%# Resources.Resource.SecureSecureSQLServerItemsMngMainCtgryFirstItemText.ToString() %>'></
asp:Label
>
<
asp:Label
ID
=
"SubCtgryDataLabel"
runat
=
"server"
Visible
=
"false"
Text='<%# DataBinder.Eval( Container, "DataItem.SubCtgry" ).ToString().Trim() %>'></
asp:Label
>
<
asp:Label
ID
=
"ESubCtgryDataLabel"
runat
=
"server"
Visible
=
"false"
ForeColor
=
"Red"
Text='<%# DataBinder.Eval( Container, "DataItem.ESubCtgry" ).ToString().Equals("") ? "Default" : (DataBinder.Eval( Container, "DataItem.ESubCtgry" ).ToString().Trim()) %>'></
asp:Label
>
<
asp:Label
ID
=
"SDataLabel"
runat
=
"server"
Text
=
""
></
asp:Label
>
<
telerik:RadComboBox
ID
=
"SubCtgryRadComboBox"
runat
=
"server"
DataTextField
=
"IText"
DataValueField
=
"ItemID"
OffsetX
=
"-30"
DataSourceID='<%# (ESubCtgryDataLabel.Text.ToString().Trim() + "SubCategoryXmlDataSource") %>'
BorderColor="Black" BorderWidth="1px"
EnableLoadOnDemand="false" HighlightTemplatedItems="true" Width="206px"
Height="150px" SelectedIndex='<%# (Convert.ToInt32(getSubCtgryIndex(SubCtgryDataLabel.Text.ToString().Trim(), ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? "Default" : (ESubCtgryDataLabel.Text.ToString().Trim())))) %>' >
</
telerik:RadComboBox
>
</
telerik:RadAjaxPanel
>
</
asp:Panel
>
</
td
>
</
tr
>
</
table
>
</
telerik:RadAjaxPanel
>
</
asp:Panel
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ViewItmLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlViewItmLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadComboBox
ID
=
"ViewItmRadComboBox"
Skin
=
"Vista"
Width
=
"205px"
BorderColor
=
"Black"
BorderWidth
=
"1px"
SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewItm" ).ToString() %>' AutoPostBack="false"
runat="server" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
runat
=
"server"
visible='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true %>'>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
runat
=
"server"
visible='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? false : true %>'>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"InsrtUserLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlInsrtUserLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
asp:Label
ID
=
"InsrtUserDataLabel"
runat
=
"server"
Text='<%# ((bool)DataBinder.Eval(Container, "OwnerTableView.IsItemInserted")) ? "" : TmonavotDB.GetUserNameByUserID(Convert.ToInt64(DataBinder.Eval( Container, "DataItem.LstUpdBy" ))) %>'></
asp:Label
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
valign
=
"top"
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ItmDescLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlItmDescLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadTextBox
ID
=
"ItmDescRadTextBox"
TextMode
=
"MultiLine"
Rows
=
"4"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.ItmDesc" ) %>' Width="780px" >
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ViewItmBigDescLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlViewItmBigDescLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadComboBox
ID
=
"ViewItmBigDescRadComboBox"
Skin
=
"Vista"
Width
=
"205px"
BorderColor
=
"Black"
BorderWidth
=
"1px"
SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewItmBigDesc" ).ToString() %>' AutoPostBack="false"
runat="server" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"TitleLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlTitleLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadTextBox
ID
=
"TitleRadTextBox"
runat
=
"server"
Text='<%# DataBinder.Eval( Container, "DataItem.Title" ) %>' Width="201px" >
</
telerik:RadTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
valign
=
"top"
>
<
asp:Label
ID
=
"ItmBigDescLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlItmBigDescLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
valign
=
"top"
>
<
telerik:RadEditor
runat
=
"server"
ID
=
"ItmBigDescRadEditor"
Height
=
"350px"
Width
=
"780px"
Content='<%# DataBinder.Eval( Container, "DataItem.ItmBigDesc") %>'
DialogsCssFile="~/Common/Controls/RadEditor/RTLRadEditorStyle/RadEditor_Dialogs_RTL.css" ContentAreaCssFile="~/Common/Controls/RadEditor/RTLRadEditorStyle/EditorContentArea_RTL.css">
<
Modules
>
<
telerik:EditorModule
Visible
=
"false"
/>
</
Modules
>
<
ImageManager
ViewPaths
=
"~/Pages/Design/Imgs/Itms"
DeletePaths
=
"~/Pages/Design/Imgs/Itms"
UploadPaths
=
"~/Pages/Design/Imgs/Itms"
/>
<
DocumentManager
ViewPaths
=
"~/Pages/Design/Imgs/Itms"
DeletePaths
=
"~/Pages/Design/Imgs/Itms"
UploadPaths
=
"~/Pages/Design/Imgs/Itms"
/>
<
MediaManager
ViewPaths
=
"~/Pages/Design/Imgs/Itms"
DeletePaths
=
"~/Pages/Design/Imgs/Itms"
UploadPaths
=
"~/Pages/Design/Imgs/Itms"
/>
</
telerik:RadEditor
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ViewPriceLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlViewPriceLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadComboBox
ID
=
"ViewPriceRadComboBox"
Skin
=
"Vista"
Width
=
"205px"
BorderColor
=
"Black"
BorderWidth
=
"1px"
SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewPrice" ).ToString() %>' AutoPostBack="false"
runat="server" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ItemPriceLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlItemPriceLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadNumericTextBox
ID
=
"ItemPriceRadNumericTextBox"
runat
=
"server"
DbValue='<%# DataBinder.Eval( Container, "DataItem.ItemPrice" ) %>' Width="201px" >
</
telerik:RadNumericTextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ViewImgLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlViewImgLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
telerik:RadComboBox
ID
=
"ViewImgRadComboBox"
Skin
=
"Vista"
Width
=
"205px"
BorderColor
=
"Black"
BorderWidth
=
"1px"
SelectedValue='<%# DataBinder.Eval( Container, "DataItem.ViewImg" ).ToString() %>' AutoPostBack="false"
runat="server" >
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxTrueText %>" Value="True" />
<
telerik:RadComboBoxItem
runat
=
"server"
Text="<%$ Resources:Resource, TelerikTrueFalseRadComboBoxFalseText %>" Value="False" />
</
Items
>
</
telerik:RadComboBox
>
</
td
>
</
tr
>
<
tr
>
<
td
class
=
"RightColumn"
>
<
asp:Label
ID
=
"ImgUrlLabel"
runat
=
"server"
Text="<%$ Resources:Resource, SItemsMngSubUserControlImgUrlLabel %>"></
asp:Label
>
</
td
>
<
td
class
=
"LeftColumn"
>
<
uc1:FileUrlFileSelectorUserControl
ID
=
"FileUrlFileSelectorUserControl1"
runat
=
"server"
/>
<
telerik:radprogressmanager
id
=
"RadProgressManager1"
runat
=
"server"
/>
<
telerik:RadUpload
ID
=
"ItmImgRadUpload"
runat
=
"server"
></
telerik:RadUpload
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"left"
colspan
=
"2"
>
<
asp:button
id
=
"btnUpdate"
text="<%$ Resources:Resource, TelerikRadGridEditFormUpdateButtonText %>" runat="server" CommandName="Update" Visible='<%# !(DataBinder.Eval( Container, "DataItem") is Telerik.Web.UI.GridInsertionObject) %>'></
asp:button
>
<
asp:button
id
=
"btnInsert"
text="<%$ Resources:Resource, TelerikRadGridEditFormInsertButtonText %>" runat="server" CommandName="PerformInsert" Visible='<%# DataBinder.Eval( Container, "DataItem") is Telerik.Web.UI.GridInsertionObject %>'></
asp:button
>
<
asp:button
id
=
"btnCancel"
text="<%$ Resources:Resource, TelerikRadGridEditFormCancelButtonText %>" runat="server" causesvalidation="False" commandname="Cancel"></
asp:button
></
td
>
</
tr
>
</
table
>
</
div
>
user control c# code:
using System;
using System.Configuration;
using Telerik.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Web.UI.WebControls;
using System.Web;
using System.Data;
using System.Data.SqlClient;
public partial class ItemsMngSubUserControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
(FileUrlFileSelectorUserControl1.FindControl("TopicLabel") as Label).Text = "ItemsMng";
}
public string getMainCtgryIndexIndex(string _text)
{
string uu = string.Empty;
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("~/Common/xml/HeaderMenu.xml"));
XmlNodeList nodes = doc.SelectNodes("/Menu/Item");
foreach (XmlNode _uu in nodes)
{
foreach (XmlAttribute ss in _uu.Attributes)
{
if (ss.Name.Equals("IText"))
{
if (ss.Value.Equals(_text))
{
uu = Convert.ToString(_uu.Attributes[0].Value);
}
}
}
}
if (uu.Equals(string.Empty))
{
return "0";
}
else
{
return uu;
}
}
public string getSubCtgryIndex(string _text, string _subCtgry)
{
string uu = string.Empty;
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("~/Common/xml/" + _subCtgry + "Menu.xml"));
XmlNodeList nodes = doc.SelectNodes("/Menu/Item");
foreach (XmlNode _uu in nodes)
{
foreach (XmlAttribute ss in _uu.Attributes)
{
if (ss.Name.Equals("IText"))
{
if (ss.Value.Equals(_text))
{
uu = Convert.ToString(_uu.Attributes[0].Value);
}
}
}
}
if (uu.Equals(string.Empty))
{
return "0";
}
else
{
return uu;
}
}
protected void MainCatgryRadComboBox_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
SubCtgryRadComboBox.Visible = true;
string tt = e.Value.ToString().Trim();
string mainCtgSelectedItemText = e.Text.ToString().Trim();
MainCtgryDataLabel.Text = mainCtgSelectedItemText;
if (mainCtgSelectedItemText.Equals(Resources.Resource.SecureSecureSQLServerItemsMngMainCtgryFirstItemText.ToString()))
{
SubCtgryRadComboBox.Visible = false;
}
if (tt.Contains("Dfos"))
{
SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
ESubCtgryDataLabel.Text = "Dfos";
SubCtgryRadComboBox.DataBind();
}
else if (tt.Contains("Studio"))
{
SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
ESubCtgryDataLabel.Text = "Studio";
SubCtgryRadComboBox.DataBind();
}
else if (tt.Contains("PrintingOnProducts"))
{
SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
ESubCtgryDataLabel.Text = "PrintingOnProducts";
SubCtgryRadComboBox.DataBind();
}
else
{
SubCtgryDataLabel.Text = Resources.Resource.SecureSecureSQLServerItemsMngSubCtgryText.ToString();
ESubCtgryDataLabel.Text = "Default";
SubCtgryRadComboBox.DataBind();
}
}
}
The above code checks the number of the attched images and if there is at least one image (file), it saves its FileName, but unfortunatily the return result is "No images are attached", thats mean, that even if I attach an image, the code doesn't read it.
Please, I need your help in order to solve the above problem,
It is appreciated to send me the modified code.
Regards,
Bader
0
Hi Bader,
Your code seems okay and I cannot point out an exact reason for the issue. However, I would advise you to double check if AJAX is disabled during upload because otherwise no files will be uploaded and the zero count of upload.UploadedFiles.Count would be expected.
Kind regards,
Tsvetina
the Telerik team
Your code seems okay and I cannot point out an exact reason for the issue. However, I would advise you to double check if AJAX is disabled during upload because otherwise no files will be uploaded and the zero count of upload.UploadedFiles.Count would be expected.
Kind regards,
Tsvetina
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>