|
I need some code references based on requirement
|
|
|
|
|
What do you mean? If you want samples or tutorials then you need to search for them yourself.
|
|
|
|
|
Thanks Richard i have done that some already, but as here will be some code group or individual, who can suggest me better.
So that's why i asked for the same
|
|
|
|
|
|
|
Hi All,
We have a large number of infopath forms that where setup by some consultants. They are bulky and well only sort of work. Just wondering if anyone has encountered a tool to convert them to a webforms project (I'm lazy). I have spent some time searching for such a tool, and not really found anything. It would be nice, not to have to try manually converting them all (I know I will have to fix all the code behind, mostly cause its a spaghetti mess).
Thanks
Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
|
|
|
|
|
I have seen some programmer in favor of generic and some in favor of concrete repository.
What i feel concrete repository would be more readable & maintainable & understandable than generic one.Although we have to write more code for concrete repository than generic repository.
what you guys think which one is the best and why ?
|
|
|
|
|
|
I changed the way my store handles querystrings by switching to route attr. Everything works fine with the routes, but I had custom error pages for the shopping pages that worked fine but don't route there anymore.
Guess my question is, when a page request that doesn't qualify with the route attr, where does the code go?
I don't even get the Global.asax Application Error any more. That's where I was handling page errors.
If it ain't broke don't fix it
|
|
|
|
|
So it's called when [Route()] constraints fail.
You add another route for the action without querystring.
None of the documentation said this was possible, and only showed examples of one route attribute. Guess you can add as many as you need.
[HttpGet]
[Route("Dp")]
[Route("Dp/{parameter:int?}/{name}")]
[HandleStoreError]
public ActionResult Dp(int? parameter, string name)
If it ain't broke don't fix it
|
|
|
|
|
one rest principal is not clear to me that is Uniform Interface
what is Uniform Interface and how to explain this with points. thanks
|
|
|
|
|
"Object reference not set to an instance of an object."
Hello Friends, i want suggestions for this problem. In ASP.net MVC am Using entity framework and trying to get a list of employees using the model class itself generated by system,now its showing me this error, how to handle it please suggest.
//Here is my index.cshtml code.
@model IEnumerable
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
Index
@Html.ActionLink("Create New", "Create")
@Html.DisplayNameFor(model => model.EmpName)
@Html.DisplayNameFor(model => model.Designation)
@Html.DisplayNameFor(model => model.Salary)
@Html.DisplayNameFor(model => model.Email)
@Html.DisplayNameFor(model => model.Mobile)
@Html.DisplayNameFor(model => model.Qualification)
@Html.DisplayNameFor(model => model.Manager)
@foreach (var item in Model) {
@Html.DisplayFor(modelItem => item.EmpName)
@Html.DisplayFor(modelItem => item.Designation)
@Html.DisplayFor(modelItem => item.Salary)
@Html.DisplayFor(modelItem => item.Email)
@Html.DisplayFor(modelItem => item.Mobile)
@Html.DisplayFor(modelItem => item.Qualification)
@Html.DisplayFor(modelItem => item.Manager)
@Html.ActionLink("Edit", "Edit", new { id=item.Eid }) |
@Html.ActionLink("Details", "Details", new { id=item.Eid }) |
@Html.ActionLink("Delete", "Delete", new { id=item.Eid })
}
|
|
|
|
|
Something is null somewhere in your code when it shouldn't be.
Since you haven't told us which line of your view the exception is thrown from, we can't give you any more details.
Debug your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello sir am attaching my homeController code to this file check it and let me know where should i make the changes and how at_least give me code_snippet for making changes into my code instead.
//HomeController
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestMvcApplication.Models;
namespace TestMvcApplication.Controllers
{
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
// get regester
public ActionResult Register()
{
return View();
}
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult Register(tblEmployee obj)
{
if (ModelState.IsValid)
{
MYDBEntities1 db = new MYDBEntities1();
db.tblEmployees.Add(obj);
db.SaveChanges();
}
return View(obj);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(UserProfile objUser)
{
if (ModelState.IsValid)
{
using (MYDBEntities1 db = new MYDBEntities1())
{
var obj = db.UserProfiles.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault();
if (obj != null)
{
Session["UserID"] = obj.UserId.ToString();
Session["UserName"] = obj.UserName.ToString();
return RedirectToAction("Register");
}
}
}
return View(objUser);
}
[HttpGet]
public ActionResult Edit(int id)
{
return View();
}
|
|
|
|
|
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 38:
Line 39:
Line 40: @foreach (var item in Model) {
Line 41:
Line 42:
Source File: c:\Users\Bittu\Documents\Visual Studio 2013\Projects\TestMvcApplication\TestMvcApplication\Views\Home\Index.cshtml Line: 40
|
|
|
|
|
You're not passing a model to the view. Therefore, it's null , and you'll get a NullReferenceException when you try to iterate over it.
Your Index action needs to create an instance of the appropriate type, and pass it to the View method.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
Is there a way to disable page zoom and enable only image zoom of the page in a touch screen?
Thanks
|
|
|
|
|
Even though you may find an way to do it with code for your picture box or so, you cannot control browser functionality user can still zoom in/out your web page
modified 20-Sep-20 21:01pm.
|
|
|
|
|
I don't get it here. I've always used HttpCookies to store multiple values in them
But using Cookie, it seems you can only store 1 value.
What I'm trying to do:
I have a mvc view called Bug Report. You click the button and it runs the Diag Controller with an action that uses HttpWebRequest and prior was WebClient. I changed it to transmit a cookie in the header, because WebClient was too basic.
On the page that is getting read, I have an home made security attrubute that uses OnActionExecuting and the ActionExecutingContext. If the request doesn't contain the session variable, it gets kicked out to Logout.
So to the best of my research, you can make a cookie container with multiple cookies.
This works fine, but I wanted to refine it more...
With HttpCookies, I can send 1 cookie with the 4 values, but with cookie, I have to send each cookie separate. I don't understand this part.
CookieContainer container = new CookieContainer();<br />
container.Add(new Cookie("a", httpCookie["a"]) { Domain = target.Host });
container.Add(new Cookie("b", httpCookie["b"]) { Domain = target.Host });
container.Add(new Cookie("c", httpCookie["c"]) { Domain = target.Host });
container.Add(new Cookie("d", "true") { Domain = target.Host });
var webRequest = (HttpWebRequest)WebRequest.Create(rUrl);
webRequest.CookieContainer = container;
using (var response = (HttpWebResponse)webRequest.GetResponse())
{
model.Page_HTML = response.ToString();
}
So I wrote this, the main cookie, but I can't figure out how to store 4 records in it.
Cookie cookie = new Cookie() {
Name = "Main",
Expires = DateTime.Now.AddMinutes(1),
Domain = target.Host,
HttpOnly = true,
Secure = true
};
On the OnActionExecuting side, I figured how to read the cookies. But it seems sort or silly to read 4 cookies. It looks like on this side I can just read a HttpCookie of any format.
HttpCookie cookie_A = filterContext.RequestContext.HttpContext.Request.Cookies.Get("a");
So my question is:
Am I beating a dead horse with a stick here and I should just be happy that the 4 cookies work?
If it ain't broke don't fix it
|
|
|
|
|
Multi-valued cookies are not a standard feature. The HttpCookie class "fakes" support by serializing the values to a string similar to a query string:
HttpCookie - Reference Source[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard!
So in other words, an HttpCookie write can write an array of values that is parsed when read by HttpCookie.
Sort of a way to make cookies easier for beginners and take the complexity out of it, or for compatibility with some other standard written by other programs. Or maybe proprietary to just reading our own cookies in asp.net - most likely answer. Sort of like those dumb html objects in webforms.
And perhaps cookie is the standard way to read and write a cookie.
Glad I didn't beat the horse more with my stick on the subject.
If it ain't broke don't fix it
|
|
|
|
|
Hi,
I have a Kendo grid I am have a dropdown as the first element of it, I want to get the selected text or value of those all drop downs if they are selected. If they are not selected there is no need to count them.
I am using jQuery to do it, tried many options so far there is no luck. Grid is very big, hence I am just putting only the code where I am trying to access it.
This is is how I am trying it, so far no luck, any help would be very helpful, thanks in advance.
var grid = $( "#budgetdGrid" );
var dataSource = grid.dataSource;
var columns = $("#budgetdGrid").data("kendoGrid").columns;
var rows = $("#budgetdGrid").data("kendoGrid").rows;
var noOfCols = columns.length;
grid.items().each(function(a) {
alert(a.text())
});
I am trying to access it within this function:
function onLineDropDownChange(e) {<br />
//alert(e.sender.select())
//alert(e.sender.text());
var grid = $( "#budgetdGrid" );
var dataSource = grid.dataSource;
var columns = $("#budgetdGrid").data("kendoGrid").columns;
var rows = $("#budgetdGrid").data("kendoGrid").rows;
var noOfCols = columns.length;
grid.items().each(function(a) {
alert(a.text())
});
//alert(e.sender.select().val())
//rows.each(function(e) {
// var grid = $("#budgetdGrid").data("kendoGrid");
// var dataItem = grid.dataItem(this);
// alert(dataItem);
//})
var tr = this.element.closest("tr");
var line_no="";
var prev_line = [];
// var line_arr = ['200', '201', '101a-cw', '101a-mc', '70p-cw', '70p-mc'];
var lin_val = tr.find("input[id^='inputLine_']").val();
if ( lin_val != "" && lin_val != 'undefined') {
line_no = tr.find("input[id^='inputLine_']").data("kendoDropDownList").text().substr(0, tr.find("input[id^='inputLine_']").data("kendoDropDownList").text().indexOf('('));
}
if (lin_val != '' && line_no != '') {
$("#doeGrid").find("#budgetdGrid tbody").find('tr').each(
function () {
var id = $(this).find("input[id^='inputLine_']").val();
if (id == lin_val && lin_val != "" && id != "") {
prev_line.push(id);
}
});
if (prev_line.length > 1) {
alert("You have already selected the Line Item in the previous rows");
}
else {
if ((line_no.substr(0, line_no.indexOf('-')) == '200') || (line_no.substr(0, line_no.indexOf('-')) == '201') || (line_no == '101a-cw') ||
(line_no == '101a-mc') || (line_no == '70p-cw') || (line_no == '70p-mc') || (line_no.substr(0, line_no.indexOf('-')) == '202' && '@Session["FiscalYearCode"]'=='FY 2015-2016')||
(line_no.substr(0, line_no.indexOf('-')) == '204' && '@Session["FiscalYearCode"]'=='FY 2015-2016')||
(line_no.substr(0, line_no.indexOf('-')) == '203' && '@Session["FiscalYearCode"]'=='FY 2015-2016') ||
(line_no.substr(0, line_no.indexOf('-')) == '205' && '@Session["FiscalYearCode"]'=='FY 2015-2016'))
//if (containsLine(line_no, line_arr))
{
if (containsAny('@Model.Service_Code', [30, 33, 34, 43, 51, 52]) && '@Model.Program_Code' >= 87) {
tr.find("input[name^='txt_budgt']").removeAttr("disabled = 'disabled'");
tr.find("input[name=txt_IndivUOS]").removeAttr("disabled = 'disabled'");
}
else if (('@Model.Service_Code' == 48 && '@Model.Program_Code' >= 87)) {
tr.find("input[name^='txt_budgt']").removeAttr("disabled = 'disabled'");
tr.find("input[name=txt_IndivUOS]").removeAttr("disabled = 'disabled'");
tr.find("input[name=txt_NtpGrp]").removeAttr("disabled = 'disabled'");
tr.find("input[name=txt_NtpDos]").removeAttr("disabled = 'disabled'");
}
else {
tr.find("input[name^='txt_budgt']").removeAttr("disabled = 'disabled'");
}
}
else if (('@Session["FiscalYearCode"]'=='FY 2016-2017') || ('@Session["FiscalYearCode"]'=='FY 2017-2018'))
{
tr.find("input[name^='txt_dirCst']").removeAttr("disabled = 'disabled'");
}
else {
tr.find("input[name^='txt_budgt']").removeAttr("disabled = 'disabled'");
}
}
}
else {
alert("Please Choose Proper Line Item");
}
}
This function will be called when there is any change in the Grid, onchange but when change occurs it has to loop through the whole grid and then find out the selected text or values of the dropdowns then it will be acted upon the selected items of the dropdowns.
Please any help would be very very supportive - thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
I don't have membership for Telerik forum, only licensed members are eligible to put questions, I am also searching but if somebody can help me, it would be a great help - thanks buddy.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
indian143 wrote: only licensed members are eligible to put questions
But surely only licensed members are eligible to use the controls?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|