href problem in asp.net mvc2

23 views
Skip to first unread message

Rajendra Prasad

unread,
Dec 27, 2010, 3:26:02 AM12/27/10
to c4...@googlegroups.com
Hi mvc,

i am new to asp.net mvc2 and i am working on asp.net mvc2 areas.

when i have a static page in area it is showing result as expected.

the problem is when i am trying to call my details page like

http://wesitename/area/controller/detailsaction/parameter i am getting a problem with my styles(missing some styles)

i mean to say i am not getting the the result as expected(without styles.).

if try to call my href="../../area/controller/details?Length=<%parameter id%>" i am getting the result with full styles loaded and with out any problem. but the peoblem is here it is passing null parameter to my action method.

how i tested means i hard coded my logic like

ActionResult Details(int? id)
{
var result=_dataContext.tablename.where(a=>a.id=2);
return View(result);
}

i dont know wat wrong with my code.

and i dont know why it is taking for above url contains length and y not for href without Length.


can anyone give me an idea wat i am doing wrong here.

or

if any complete example for areas with CRUD operations.

thanks in advance.

Reddy

unread,
Dec 27, 2010, 10:24:21 AM12/27/10
to c4...@googlegroups.com
Try

var result=_dataContext.tablename.where(a=>a.id==2);


--
You received this message because you are subscribed to the "Community for ASP.NET MVC" group.
 
To post to this group, send email to c4...@googlegroups.com
 
To unsubscribe from this group, send email to
c4mvc+un...@googlegroups.com
For more options, visit this group at
http://CommunityForMvc.Net

Rajendra Prasad

unread,
Dec 27, 2010, 11:38:54 PM12/27/10
to c4...@googlegroups.com
hi,

thanks for u r quick response but tht is not my question

i need to code for a dynamic view which it has to redirect for details page

i am unable to redirect to details with complete syles.

for eg:href="../../area/controller/actionmethod/parameter

if i pass like this, i am missing my styles wat exactly showing for

other static pages.

my question is, if i pass my url with params it was showing without styles.

Suksan Interaxa

unread,
Dec 27, 2010, 9:30:52 PM12/27/10
to c4...@googlegroups.com
I don't understand quite, what you try to explain but if you catch the right think, you have a problem while creating a link with parameter but it just return "../../area/controller/details?Length=<%parameter id%>"?


i am getting a problem with my styles(missing some styles)
> try with "/content/site.css" instead of "../../Content/Site.css"

--
Regards
Suksan "Jack" Interaxsa 
Graphic & Development
______________________________________________

Hosting Group Co., Ltd.
        PROFESSIONAL        SOLUTION        GUARANTEED        
20/159 Moo 10,
T. Nongprue, A. BanglamungChonburi 20150 THAILAND

Tel. 038 724 005 Fax. 038 724 006
open Mo. - Fr. form 09.30 to 18.00
Managing Director: Bjørn Hellesylt
Technic Director: Szab Virag
Need help? Click here: http://support.hostinggroup.info

Adam Tolley

unread,
Dec 28, 2010, 12:33:06 AM12/28/10
to c4...@googlegroups.com

Terry Brown

unread,
Dec 28, 2010, 2:58:57 AM12/28/10
to c4...@googlegroups.com
It sounds (though apologies if not, I'm finding your question difficult to work out the problem) very much like your reference to your CSS documents is a hard coded link rather than letting MVC handle it relatively?

If you are doing something like this in your include of your CSS (in your masterpage?):

<link rel="stylesheet" type="text/css" href="../yourstyles.css">

then you are going to run into troubles.  Try something like:

<link rel="stylesheet" type="text/css" href="<%=Url.Content("~/yourstyles.css")%>">

instead?  This will resolve, no matter what the path in your current site.


Of course, if this doesn't represent your problem, then I'm misunderstanding.  If you could let us know exactly how you are including your CSS (if it's the CSS rules that aren't being applied) and we can work from there?

Cheers,
Terry

Terry_Brown

unread,
Dec 28, 2010, 3:14:21 AM12/28/10
to Community for ASP.NET MVC
It sounds (though apologies if not, I'm finding your question
difficult to work out the problem) very much like your reference to
your CSS documents is a hard coded link rather than letting MVC handle
it relatively?

If you are doing something like this in your include of your CSS (in
your masterpage?):

<link rel="stylesheet" type="text/css" href="../yourstyles.css">

then you are going to run into troubles. Try something like:

<link rel="stylesheet" type="text/css" href="<%=Url.Content("~/
yourstyles.css")%>">

instead? This will resolve, no matter what the path in your current
site.


Of course, if this doesn't represent your problem, then I'm
misunderstanding. If you could let us know exactly how you are
including your CSS (if it's the CSS rules that aren't being applied)
and we can work from there?

Cheers,
Terry



On Dec 27, 8:26 am, Rajendra Prasad <rajaji....@gmail.com> wrote:
> Hi mvc,
>
> i am new to asp.net mvc2 and i am working on asp.net mvc2 areas.
>
> when i have a static page in area it is showing result as expected.
>
> the problem is when i am trying to call my details page like
>
> http://wesitename/area/controller/detailsaction/parameteri am getting a
Reply all
Reply to author
Forward
0 new messages