 |
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
I am writing to seek help in, how can I add page filter parameter to my method below, which can allow me to call a query string such as -- api/feed?name=st&page;=2.
I have tried using the page size property to make this work but the output would always give me 'no data response'. This is what I currently have and I am little stuck in how can I make this work.
Please advice. Any solution would be most helpful. Many thanks.
public HttpResponseMessage get([FromUri] Query query )
{
int pageSize = 10;
int page = 0;
IQueryable<data_qy> Data = null;
if (!string.IsNullOrEmpty(query.name))
{
var ids = query.name.Split(',');
var dataMatchingTags = db.data_qy.Where(c => ids.Any(id => c.Name.Contains(id)));
if (Data == null)
Data = dataMatchingTags;
else
Data = Data.Union(dataMatchingTags);
}
if (Data == null)
Data = db.data_qy;
if (query.endDate != null)
{
Data = Data.Where(c => c.UploadDate <= query.endDate);
}
if (query.startDate != null)
{
Data = Data.Where(c => c.UploadDate >= query.startDate);
}
var totalCount = Data.Count();
Data = Data.OrderByDescending(c => c.UploadDate);
var data = Data.Skip(pageSize * page).Take(pageSize).ToList();
if (!data.Any())
{
var message = string.Format("No data found");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}
return Request.CreateResponse(HttpStatusCode.OK, new { totalCount, data });
}
|
|
|
|
 |
Hi,
I have a web service.
In certain scenarios, I want to send specific status Codes back to the client.
I tried using the context.Response.statusCode but it doesn't work.
Anyone knows how can I accomplish that?
|
|
|
|
 |
Always include the relevant code in your question.
ThetaClear wrote: I tried using the context.Response.statusCode but it doesn't work. how? you got any error? debug it. Update your question with error details.
|
|
|
|
 |
I just wrote something like that:
Context.Response.StatusCode = 422;
and expected to get 422 on the client but I got 200
|
|
|
|
 |
hi everyone, i have been trying to create reports at runtime using crystal reports and vb.net, i want the user to select the fields/columns he wants to view in the report and choose as many fields as he wants.i have been searching for such but got no straight forwad answer. can anyone kindly help with such a solution
|
|
|
|
|
 |
Hi.
I have an application consists of 2 textboxes, 2 buttons, a modalpopup extender.
Button1 and Textbox1 is in a modalpopupextender that is shown when a button is click (not shown here)
I added an OnKeyPress event on my textbox (Textbox1) on Page Load that will execute a javascript on client side code which calls a button (Button1) click event.]
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.TextBox1.Attributes.Add("onKeyPress", "doClick('" + Button1.ClientID + "',event)");
}
}
This is the Javascript codes, this will call and execute the click event of Button1
function doClick(buttonName, e) {
var key;
if (window.event)
key = window.event.keyCode; else
key = e.which; if (key == 13) {
var btn = document.getElementById(buttonName);
if (btn != null) { btn.click();
event.keyCode = 0
}
}
};
This is the Button1 Click event
protected void Button1_Click(object sender, EventArgs e)
{
if (Textbox1.Text.ToString() == "ITDevt")
{
Button2.Visible = true;
Textbox2.Visible = false;
Button2.Visible=true;
Button1.Visible=false;
popup.Show();
}
else
{
popup.Hide();
Textbox1.Text = "";
}
}
Assume that the modalpopupextender is shown, so I entered a text in Textbox1 and presses Enter key on keyboard (so the OnKeyPress event is rendered).
When I trace the Button1_Click event, the code block runs. But the popup (modalpopupextender) hides.
Can you help me show again the modalpopupextender and hide Button1 and Textbox1 then show Button2 and Textbox2?
|
|
|
|
 |
Hello , I need to copy the structure of a gridview programatically to an another new grid view , is that even possible ?
|
|
|
|
 |
Possibly you're talking about this[^]
|
|
|
|
 |
Hello !
I am building a MVC 5 app in which there will be 4 types of users . (Admin , HR Member , Managers , Employee) . I already created the views and the controllers for each type .
I want to give each manager access to certain departments , and the employee access to data according to his employeeID value .
After reading several articles on the Internet about this topic , I suppose I have to assign each user type a role and each department/employeeID a permission , but I have no clue on how to do that .
Can someone explain to me how to implement this ? I mention that the Identity Framework installed on the project is at version 1.0 .
|
|
|
|
 |
You need to create Roles & Permissions. You need to create a table (like "Roles") that store the Roles In your app there is 4 Roles 1- Admin 2- HR Member 3- Managers 4- Employee And need to store all the permissions in a Table (like "Permission" table). for each Role you need to map the permissions means to specify what are the permission available for Admin, HR Member, Managers & Employee. To do this you need to create a table (like RolesPermission) that contains the Id of Role and also the Ids of Permission that "One To Many" mapping. like ID RoleId PermissionId 1 1 1 2 1 2 3 1 4 4 2 4 5 2 5 ... ... ... After that you just need to assign the Role to the users. And where the user can access resources or not You just need to get Permissions of that user and check the permission that available to access the resources. If available then give access otherwise don't give access.
|
|
|
|
 |
Ok , in other words I should have three classes :
Role
Permission
RolePermission(in which I should include two objects , one of type Role , and one of type Permission)
And I should link the RolePermission to the ApplicationUser , then apply the migration .
Is that correct ?
|
|
|
|
 |
Yes
|
|
|
|
 |
Ok , I got stuck again .
So I created the classes :
Role :
public class Role
{
public Role() { }
public Role(string name, int id):this()
{
this.RoleId = id;
this.Name = name;
}
[Key]
[Required]
public virtual int RoleId { get; set; }
public virtual string Name { get; set; }
}
Permission :
public Permission()
{ }
public Permission(string name,int id):this()
{
this.Name=name;
this.Id = id;
}
[Key]
[Required]
public virtual int Id { get; set; }
public virtual string Name { get; set; }
}
RolePermission :
public class RolePermission
{
public Role Role { get; set; }
public Permission Group { get; set; }
[Required]
public int RoleGroupId { get; set; }
public RolePermission() { }
}
I updated the ApplicationUser class
public class ApplicationUser : IdentityUser
{
public ApplicationUser()
: base()
{
this.Permission=new HashSet<RolePermission>();
}
[Required]
public string Name { get; set; }
public virtual ICollection<RolePermission> Permission { get; set; }
}
Is this correct up to this point ?
I suppose I should modify the ApplicationDbContext , which , up to this point , looks like this :
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
}
What changes should I do ?
|
|
|
|
 |
Yes you are right. You should use this one public class ApplicationDbContext : IdentityDbContext<ApplicationUser> { public ApplicationDbContext() : base("DefaultConnection") { } }
|
|
|
|
 |
hi . i have two website ballychohan.com and baljinderchohan.com. both are in php. i want to integrate both in single domain. what to do
|
|
|
|
|
 |
gauravkumar02 wrote: both are in php
And what does that have to do with ASP.NET?
Also, you might want to get a native English speaker to proof-read your text. Your site is full of basic grammatical and punctuation errors, which gives an extremely poor first impression - particularly for a company which claims to be based in the UK!
And for that matter, why would you want to combine the website of "a leading IT company" with that of a supplier of "Indian Cuisine in the UK"?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
... and the "Testimonials" are from companies that don't exist.
|
|
|
|
 |
Hm, perhaps that was an SEO attempt? But he failed to set up proper links to his web sites...
And it could be an interesting combination: buy a webhosting package, get a pappadum for free.
|
|
|
|
 |
Hi, I am trying to load an SWF flash file in an ASP.NET page. embed URL is pointing to the file in my D:\ drive. Can you please tell me whats wrong in the below code? Movie not loaded message is coming. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="980" height="634"> <param name="movie" value="video/D:\Articulate\story.swf" /> <param name="quality" value="high" /> <embed src="video/D:\Articulate\story.swf" width="”980" height="634" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" /> </object> Thank You Suresh Katari
|
|
|
|
 |
You're doing it wrong. Remove the Video/ before the path.
You should not use absolute path. Use relative path. Save the swf file in same path where you have the html file.
Check this for simple example. HTML - Plug-ins[^]
|
|
|
|
 |
Thank you raja. As you mentioned "video/" is wrong and absolute path is also wrong. By my requirement is i have a set of SWF files which will be in a network shared folder and i have to access them in my asp.net page. So i must use absolute path in the src. Is this can be done? or i must copy all those SWF files to my web folder?
|
|
|
|
 |