if (e.CommandName == "Ver")
{
string Servidor = Request.Url.GetLeftPart(UriPartial.Authority);
string fullUrl = Servidor + Session["strUrl"];
OpenFile(fullUrl);
}
var usuarioSesion = (Usuario)Session["usuarioSesion"];
var dbContext = new BD_SSEGUAEntities();
string strUrl;
int exp = Convert.ToInt32(Session["ExpEmp"]);
int folio = Convert.ToInt32(Session["Foliosol"]);
var newDoc = new Documento();
foreach (UploadedFile file in RadUpload1.UploadedFiles)
{
// var ResultSol = new Solicitud();
var fileName = folio + "-" + file.GetName().ToLower();
file.SaveAs(MapPath(@"~/docs/" + fileName));
strUrl = "/docs/" + fileName;
//MapPath(@"/docs/")+file.GetName();// + ResultSol.fiIdSolicitud + "-" +
if (RadUpload1.InvalidFiles.Count == 0 && RadComboBox1.SelectedValue!=null )
{
try
{
var doc = new Documento
{
fiIdSolicitud = folio,
fiAnioSolicitud = (short) DateTime.Now.Year,
fiIdTipoDocumento = (byte) TipoDoc,
fiIdEdoDocto = 1,
fdFchRegDocto = DateTime.Now,
fiUsrRegDocto = usuarioSesion.Expediente,
fcURLdocumento = strUrl,
};
dbContext.Documento.AddObject(doc);
dbContext.SaveChanges();
Alerta("El documento se guardó de forma correcta");
}
catch (Exception ex)
{
Alerta(ex.Message);
}
llenaGridDocs();
}
else
{
Alerta("Captura los todos los datos");
}
// else
//{
// Alerta("Agrega un documento");
//}
}
}
<
div
id
=
"form"
>
<
form
method
=
"post"
action
=
" somefile.php "
name
=
"profile"
enctype
=
"multipart/form-data"
onsubmit
=
"xmlhttpPost('somefile.php', 'profile', 'MyResult'); return false;"
">
<
label
for
=
"Upload Image"
>Upload Image</
label
>
<
input
name
=
"file_name"
type
=
"file"
>
<
div
class
=
"input-row"
><
label
for
=
"mail"
>E-mail: </
label
><
input
id
=
"mail"
name
=
"mail"
type
=
"text"
/></
div
>
<
input
name
=
"upload"
value
=
"Upload"
type
=
"submit"
>
</
form
>
</
div
>
<!-- end form -->
<
div
id
=
"MyResult"
></
div
>
<?
php
include_once( 'class/class.upload.php' );
if(isset($_POST['upload'])){
$filname=$_FILES['file_name'];
$
handle
=
new
upload($filname);
$handle->allowed = array('image/*');
if($handle->uploaded){
$handle->image_border = 5; // defining border width
$handle->image_border_color = '#000'; // defining border color
$handle->image_watermark = 'badge.png'; // watermark image src
$handle->image_watermark_position = 'BR'; // watermark image position again "B" for bottom and so on.
$handle->image_resize = true; // making resize function to true
$handle->image_x = 160; // making width to 160px
$handle->image_y = 160; // making hight to 160px
$handle->process('uploads/');
if ($handle->processed) {
//$message = '<
div
class
=
"center"
><
p
>Border color #F58462 added successfully</
p
><
img
src="uploads/'.$handle->file_dst_name.'" alt="" /></
div
>';
//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));
$to = $_POST['mail'];
$from = 'adamkischi@gmail.com';
$subject = 'the subject';
$headers = 'From: '.$from. "\r\n" . 'Reply-To: '.$from. "\r\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$headers .= "This is a multi-part message in MIME format.\n";
$headers .= "--".$strSid."\n";
$headers .= "Content-type: text/html; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: 7bit\n\n";
if($_FILES["file_name"]["name"] != "") {
$strFilesName = $_FILES["file_name"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents('uploads/'.$strFilesName)));
$headers .= "--".$strSid."\n";
$headers .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$headers .= "Content-Transfer-Encoding: base64\n";
$headers .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$headers .= $strContent."\n\n";
}
$flgSend = @mail($to, $subject, $message, $headers); // @ = No Show Error //
if($flgSend){
echo "Mail send completed.";
$tmpfile = 'uploads/'.$strFilesName;
if(file_exists($tmpfile)) {
unlink($tmpfile);
}
}
else{
echo "Cannot send mail.";
}
}
}
}
?>
$(
".profile"
).colorbox(
{width:
"80%"
, height:
"80%"
}
);
// X Axis properties
chart.PlotArea.XAxis.VisibleValues = ChartAxisVisibleValues.Positive;
chart.PlotArea.XAxis.Step = 1;
chart.PlotArea.XAxis.LabelStep = 2;
chart.PlotArea.XAxis.IsZeroBased =
false
;
chart.PlotArea.XAxis.AutoScale =
false
;
chart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.General;
I have a RadGrid where one of the columns is a GridTemplateColumn with a RadComboBox:
<
telerik:RadGrid
ID
=
"EmployeeRadGrid"
runat
=
"server"
Width
=
"96%"
GridLines
=
"None"
AutoGenerateColumns
=
"False"
PageSize
=
"13"
AllowSorting
=
"True"
AllowPaging
=
"True"
ShowStatusBar
=
"true"
Visible
=
"False"
OnUpdateCommand
=
"EmployeeRadGrid_UpdateCommand"
OnNeedDataSource
=
"EmployeeRadGrid_NeedDataSource"
OnInsertCommand
=
"EmployeeRadGrid_InsertCommand"
OnDeleteCommand
=
"EmployeeRadGrid_DeleteCommand"
onitemdatabound
=
"EmployeeRadGrid_ItemDataBound"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
MasterTableView
DataKeyNames
=
"EmployeeID"
AllowMultiColumnSorting
=
"True"
Width
=
"100%"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"Name"
SortExpression
=
"Name"
HeaderText
=
"Navn"
DataField
=
"Name"
/>
<
telerik:GridTemplateColumn
UniqueName
=
"EmployeeID"
HeaderText
=
"Departement"
>
<
ItemTemplate
>
<%#DataBinder.Eval(Container.DataItem, "DepartementName")%>
</
ItemTemplate
>
<
EditItemTemplate
>
<
telerik:RadComboBox
runat
=
"server"
ID
=
"RadComboBox1"
Width
=
"200"
DataTextField
=
"Name"
DataValueField
=
"DepartementID"
DataSourceID
=
"DepartementDataSource"
AllowCustomText
=
"False"
EnableAutomaticLoadOnDemand
=
"true"
OnClientLoad
=
"OnClientLoadHandler"
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
The RadComboBox1 is populated through the ItemDataBound event of the EmployeeRadGrid:
protected void EmployeeRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item.IsInEditMode)
{
GridEditableItem item = (GridEditableItem)e.Item;
if (!(e.Item is IGridInsertItem))
{
RadComboBox combo = (RadComboBox)item.FindControl("RadComboBox1");
combo.Items.Clear();
List<
DepartementResult
> deps = getDepartements();
foreach (DepResult dep in deps)
{
RadComboBoxItem newItem = new RadComboBoxItem();
newItem.Text = dep.Name;
newItem.Value = dep.DepartementID.ToString();
newItem.Attributes.Add("DepartementName", dep.Name);
combo.Items.Add(newItem);
newItem.DataBind();
}
combo.SelectedValue = ((DepartementResult)e.Item.DataItem).DepartementID.ToString();
}
}
}
I also have another RadGrid, where all the departements are listed, and the user can make changes to them.
What I want is that the departements listed in RadComboBox1 are updated after changes are made in the DepartementRadGrid. Now what happens is that the RadComboBox1 is disabled in a way, - nothing happens if I click on it. The other column in the EmployeeRadGrid is editable.
If I open my page and go straight to the EmployeeRadGrid, I can access the RadComboBox1, and change the departement. But if I make changes in the EmployeeRadGrid, the RadComboBox is not responsive.
Any help is appreciated.