|
Hi All,
I am working with Telerik Ajax Controls called RadWindow, RadBinaryImage, RadAsyncUpload and RadImageEditor, all these are working fine on my local machine, when I deploy app on the server, the controls are not working. These controls are in a separate page which actually opens as a Popup. And when I deploy the Application on the Server it stops working I am not sure is it because of the Version mismatch of the Telerik Controls. Is there any way to validate it? or is there any way I can Xcopy the application files and set that my application should use Local copy of the Telerik dlls.
I doubt it should the same reason because sometime before it gave the similar problems because of the mismatch. Thank you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Make sure the appropriate .NET also exists on the server.
You also most likely need to modify the folder permissions on the server. Make sure that IIS_IUSRS (or the service account, if appropriate) has the appropriate permissions per folder, I'm sure that the Telerik documentation has those details.
|
|
|
|
|
Yeah thank you that part is working when I say browse by going into the application, but some CSS is missing may be I am guessing that JavaScript/CSS/Images aren't fully loading.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Which is easier to work, its MVC using Asp or MVC using Razor ???
|
|
|
|
|
Depends on who you ask. I suggest you go through articles on the topic and find what you are more comfortable with.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Use Razor, the asp.net engine is well deprecated.
|
|
|
|
|
Smart tags are a cruel joke on the unwary.
Razor is simplistic and fully supports separation of concerns.
Easy pick.
|
|
|
|
|
Razor would be better as compared to ASP engine. Firstly razor syntax is easy to learn and use.
Razor uses @ symbol but asp uses <%: %> to write code in view page. Razor is very compact and helps to reduce typing. Razor helps to prevent XSS attack in view page.
Now a days mostly developers are using Razors as compared to asp.
modified 27-Feb-16 2:21am.
|
|
|
|
|
Razor will be best.
|
|
|
|
|
I have the following index-method in my homecontroller:
var homeIndexModel = new HomeIndexModel()
{
ActiveTasks = tasks.Where(
task =>
task.TaskStatus != TaskStatusEnum.Deferred &&
task.TaskStatus != TaskStatusEnum.Verified && task.TaskStatus != TaskStatusEnum.Resolved),
ClosedTasks = tasks.Where(
task =>
task.TaskStatus == TaskStatusEnum.Resolved),
DeferredTasks = tasks.Where(
task =>
task.TaskStatus == TaskStatusEnum.Verified ||
task.TaskStatus == TaskStatusEnum.Deferred),
Rules = m_errandSvc.GetAllRules(),
Sources =
Enum.GetValues(typeof(TaskSourceEnum)).Cast<TaskSourceEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
Types =
Enum.GetValues(typeof(TaskTypeEnum)).Cast<TaskTypeEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
Counties = counties,
Reports = null,
};
return this.View(homeIndexModel);
This homeIndexModel Is passed to the view when you visit the firstpage. As you can see, I assaign a Report-object to null.
I want to use thise Report-property of homeIndexModel when I do a search On the firstpage. When I hit "Search", a modal should appear and the search result printed out.
Here Is my search-method in the controller:
[HttpPost]
public ActionResult SearchReport(string searchVal, string searchParam)
{
var reports = m_errandSvc.GetReportSearch(searchVal, searchParam).ToList();
var homeIndexModel = new HomeIndexModel()
{
Reports = reports
};
return this.View(homeIndexModel);
}
As you can see, I assaign the Report-property with the result of GetReportSearch. I want to loop through this object below:
<!-- Modal -->
<div class="modal" id="myModalSearch" aria-hidden="true" data-keyboard="false" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="panel panel-default">
<div class="panel-heading">
<h4>FISH</h4>
@if (Model.Reports != null)
{
}
</div>
</div>
</div>
</div>
</div>
</div>
The problem I have is that when I add a foreach, like this below, my debug-mode quits.
@if (Model.Reports != null)
{
foreach(var itm in Model.Reports)
{
<div>@itm.Report_id</div>
<div>@itm.ReportSource</div>
}
}
How can I solve this whole thing with homeIndexViewModel and print out my search-result as I want to?
|
|
|
|
|
You do this in a lot of ways.
If you want to use server-side code (namely Razor) to build your view and absolutely have to embed your reports in the homeIndexModel, then you'll need to perform a postback and add an optional search term to your Index action (or whatever you have your default action named).
public ActionResult Index(string searchVal = null, string searchParam = null)
{
...
var homeIndexModel = new HomeIndexModel()
{
ActiveTasks = tasks.Where(
task =>
task.TaskStatus != TaskStatusEnum.Deferred &&
task.TaskStatus != TaskStatusEnum.Verified && task.TaskStatus != TaskStatusEnum.Resolved),
ClosedTasks = tasks.Where(
task =>
task.TaskStatus == TaskStatusEnum.Resolved),
DeferredTasks = tasks.Where(
task =>
task.TaskStatus == TaskStatusEnum.Verified ||
task.TaskStatus == TaskStatusEnum.Deferred),
Rules = m_errandSvc.GetAllRules(),
Sources =
Enum.GetValues(typeof(TaskSourceEnum)).Cast<TaskSourceEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
Types =
Enum.GetValues(typeof(TaskTypeEnum)).Cast<TaskTypeEnum>().AsEnumerable().OrderBy(taskSource => taskSource.AsString()),
Counties = counties,
Reports = (val == null || parameters == null)
? null
: m_errandSvc.GetReportSearch(searchVal, searchParam).ToList();
};
return View(homeIndexModel);
}
You could also decouple the reports from the HomeIndexModel and send it down as a partial view, if you prefer to use AJAX but still want to use Razor.
|
|
|
|
|
Hi All,
I am using file upload I am trying get the uploaded file size in client script for IE and Chrome browsers I have been trying for it in the below ways. Can any body please help me with that, I have been with no luck so far. One of this approach worked on another application on the same machine and browser and now its not working when I put this on the original larger application.
Any help may be a code snippet, a link or even a suggestion helps.
function CheckImageTypeAndSizeAdd() {<br />
var fileName = $('input[type=file]').val();
alert(fileName);
var fileSize;
alert($('<%= fileUploadCurriculumVitaeAdd.ClientID %>').val);
<%-- $(function () {
$('<%= fileUploadCurriculumVitaeAdd.ClientID %>').change(function () {
var f = this.files[0]
fileSize = f.size;
if (f.size > 8388608 || f.fileSize > 8388608) {
alert("Allowed file size exceeded. (Max. 8 MB)")
this.value = null;
}
})
});--%>
try {
fileSize = aspFileUpload.files[0].size;
} catch (e) {
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var e = objFSO.getFile(fileName);
fileSize = e.size;
}
alert(fileSize);
var ext = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();
if (!(ext == "docx" || ext == "doc" || ext == "pdf")) {
errorLabel.innerHTML = "Invalid file type, must select a *.doc, *.docx, or *.pdf file.";
$('input[type=file]').val() = "No file chosen";
return false;
}
if (fileSize == -1) {
errorLabel.innerHTML = "Couldn't load doc file size. Please try to save again.";
$('input[type=file]').val() = "No file chosen";
return false;
}
else if (fileSize <= 2097152) {
errorLabel.innerHTML = fileName;
return true;
}
else {
var fileSize = (fileSize / 1048576);
errorLabel.innerHTML = "File is too large, must select file under 20 Mb. File Size: " + fileSize.toFixed(1).toString() + " Mb";
$('input[type=file]').val() = "No file chosen";
return false;
}
}
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Don't repost your questions, see my answer to your initial question, using ActiveX controls is going to work on very few machines, use the html5 file api instead. Or just google your problem and you'll easily find the answers, this is a common requirement.
|
|
|
|
|
Hi All,
I am using ASP.Net file upload control, when no file selected it says "No file chosen" but when a user selects wrong file I am showing a prompt message that incorrect file. But after that I want to set the message of the file upload control as "No file chosen" again, instead it is showing me the wrong file name.
Can anybody please help me in that regards? Any help a code snippet, a link or even a suggestion helps.
Here is my code:
<script type="text/javascript">
function ShowThumbnail() {<br />
var aspFileUpload = document.getElementById("FileUpload1");
var errorLabel = document.getElementById("ErrorLabel");
<pre>
var fileName = aspFileUpload.value;
var ext = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();
if (ext == "docx" || ext == "doc" || ext == "pdf") {
aspFileUpload.innerHTML = "";
aspFileUpload.innerText = "";
return true;
}
else {
errorLabel.innerHTML = "Invalid image file, must select a *.doc, *.docx, or *.pdf file.";
}
}
<asp:fileupload id="FileUpload1" runat="server" onchange="ShowThumbnail();">
<asp:customvalidator id="customValidatorUpload" runat="server" errormessage="" controltovalidate="FileUpload1" clientvalidationfunction="ShowThumbnail();">
<asp:label id="lbl_uploadMessage" runat="server" text="">
<asp:label id="ErrorLabel" runat="server" text="">
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Hi All,
Some long time I have not been using File Upload, but when I tried now I need to write lot of Client side scripting to validate the size and type of the files. Can somebody please help me in implementing the above functionalities like immediately after use selecting a file it checks the file size and its type if they are not matching it throws error instead of clicking some other button or etc.
If I can do this by using Server side code that's better but if I have to use the Client side code then fine too. Please help me in this regards.
Any help may be code snippet, a link or even a suggestion greatly appreciate. Thanks in advance buddies.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
If you're using Bootstrap, this plugin[^] works really well.
There's also this one[^], which only requires jQuery.
Both are free and open-source.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am not familiar much with using the jquery libraries and I am sorry but I am not good in using built-in Java Script libraries like Kendo or from some other vendors etc.
I am writing my own JavaScript code.
Can you please help me in setting the value of the File upload when user selected the wrong file, it should either set to empty or "No file chosen" as it says in the begging, but Webforms file upload is showing the wrongly selected file in the file path box. Remaining script I was able to manage.
Can you please help me in this, any help like a code snippet, a link or even a suggestion helps me great. Thanks in advance buddy.
Like in the below function I need to set the value of the file upload to "No file chosen", if I try to set it up its not setting with value or val property.
<script type="text/javascript">
function CheckImageTypeAndSize() {
var aspFileUpload = document.getElementById("FileUpload1");
var errorLabel = document.getElementById("lbl_uploadMessage");
var img = document.getElementById("imgUploadThumbnail");
<pre>
var fileName = aspFileUpload.value;<br />
var fileSize; errorLabel.innerHTML = "";
try {
fileSize = aspFileUpload.files[0].size;
} catch (e) {
var objFSO = new ActiveXObject("Scripting.FileSystemObject");
var e = objFSO.getFile(aspFileUpload.value);
fileSize = e.size;<br />
}
var ext = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();
if (!(ext == "docx" || ext == "doc" || ext == "pdf")) {
errorLabel.innerHTML = "Invalid image file, must select a *.doc, *.docx, or *.pdf file.";
return false;
}
if (img.fileSize == -1) {
errorLabel.innerHTML = "Couldn't load doc file size. Please try to save again.";
return false;
}
else if (img.fileSize <= 2097152) {
errorLabel.innerHTML = fileName;
return true;
}
else {
var fileSize = (fileSize / 1048576);
errorLabel.innerHTML = "File is too large, must select file under 20 Mb. File Size: " + fileSize.toFixed(1).toString() + " Mb";
return false;
}
}
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
You can only do this if the client supports the relevant html5 apis. Google "html5 restrict file upload size" and you'll find examples on how to do this, it's a common request. For clients that don't support html5 you'll need to do the checks server-side after the file has already been uploaded.
|
|
|
|
|
How to filter data in DataTable using like operator ?
|
|
|
|
|
Do you mean filter the records exrtracted from your database?
|
|
|
|
|
|
Hi ,
i have a Fuel table with following fields :
ColumnName:
1.BillNo 2.BillDate 3.Amount 4.EmployeeId
1001 24.02.2015 1000 e101
1002 25.02.2016 586 e102
and also i bind the dropdownlist with employee tale with following fields
1.Employee Id(Selected value)
2.Employee Name(Display Value)
In My View I have DDL_Employee(dropdownlist) ,txt_fuel(textbox)
Now my question is While i am selecting DDL_Employee value(E101) Amount of 1000 will binidng in txt_Fuel
How to do this Task in Asp.Net Mvc, i am familiar with c# windows application, but here i am stuck in asp.net MVC ,
Give Any Suggestion
|
|
|
|
|
You have to use jquery change event on ddl. In the change event call action in your controller and retrieve the value and update it in textbox
|
|
|
|
|
Hi All,
I am storing a file into Database as Image type along with its extention in another column, I am giving a link button when user clicks on that button the file should be able to be downloaded in the same format as it is stored in database that's nothing but the type user has uploaded the file.
Any help is appreciated a code snippet, a link or even a suggestion is appreciated. Thanks you.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|