Web Forms :: Passing Parameter While Routing?
Feb 12, 2011
i am doign url routing and it is working fine with url like followwing:-when ever i click on HOME/SEARCH i get redirected to ~/SEARCH1.aspx page.
[Code]....
BUT IF I REPLACE THE ABOVE URL WITH "~/SEARCH1.ASPX?ID=2"I GOT FOLLOWING ERROR:'~/search1.aspx?id=2' is not a valid virtual path. 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.Web.HttpException: '~/search1.aspx?id=2' is not a valid virtual path.i have to pass id to the search1.aspx page.what is the way out.
View 5 Replies
Similar Messages:
Jul 24, 2010
This question is related to the asp.nt 4.0 routingI have a URL http://www.asp.net?CountryID=65&CountryName=Singaporeafter implementing routing i will get the URL as http://www.asp.net/65/Singapore/is there any way i can use the URL as http://www.asp.net/Singapore/its possible after removing the parameter CountryID, but the problem am facing here is, I also want to access the value 65 in the redirected page.
View 5 Replies
Apr 30, 2010
I am working on a website in asp.net mvc. I have a route
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
ew { controller = "Home", action = "Index", id = UrlParameter.Optional }
View 4 Replies
Sep 17, 2010
When a user clicks on a link, I want to log some information. I can't do an AJAX request because if they clicked on a link, the page will unload (since they're going to a new page), and I don't want to force them to stay on the page until a synchronous event finishes. So one idea I had was to add a parameter to the url. I.e. the urls would be actual/action?actualParams&infoIWantToLog=data. Then I could strip off the info I want to log, log that, and then pass off their URL to the action which they actually wanted to go to. Is this possible to do with MVC routing?
View 1 Replies
Jan 12, 2011
I am learning .net and building a site that uses url routing. I have it working although when attempting to get data from a database i am having to pass a ID parameter such as:
services/{id}/{category}/{subcategory}
portfolio/{id}/{category}/{title}
blog/{date}/{id}/{title}
I have seen websites that do the same thing but they don't appear to be passing an ID parameter, how do they acheive this?
if they wanted the information on a particular service as per the link above would you just run an SQL query looking for a match on the subcategory name or for a blog post you look for a match on the blog title and date?
It just seems a bit strange to me and if you have people adding blog posts etc there is always the slim possibility of more than one match.
View 4 Replies
Sep 4, 2010
I'm starting a port of an existing ASP.NET Web Forms CMS to ASP.NET MVC and want to get the routing right from the start.Note: it isn't important to have the exact same URL structure.I think this answer is close to what I'm looking for but would like some additional input should anyone have it.
?Content=News/CurrentNews/This_is_a_news_article
?Content=Corporate/About_Us/Overview
[code]...
View 1 Replies
Jan 26, 2011
I'm wanting the URL to my MVC application to be like:www.site.com/BobWhich would in turn 'redirect' to Home/Details/Bob.I've set up the following MapRoute:routes.MapRoute( _Nothing, _"{personName}", _New With {.controller = "Home", .action = "Details", .personName = ""}, _
New With {.result = New NameConstraint()} _
View 1 Replies
Mar 17, 2011
I am opening one page and sending parameter from one asppage to other using winodow.open method
var retVal = window.showModalDialog("PopupWindow.aspx?SQL=" + document.getElementById(SUCName.concat("txtRetVal")).value +
"&Curr_Date=" + d , null,"dialogLeft=" + XPos + ";dialogTop=" + YPos +
";center=no;status=no;dialogHeight:430px;dialogWidth:420px;resizable=no;help=no");
in my document.getElementById(SUCName.concat("txtRetVal")).value contains:
SELECT ResourceID, ResourceName FROM ResourceMaster WHERE AREA LIKE '%CALICUT%'
but when it access this on PopupWindow.aspx using Request.QueryString("SQL") then first 3 character in LIKE clause gets convert to some ascii character and my query becomes
SELECT ResourceID, ResourceName FROM ResourceMaster WHERE AREA LIKE '�LICUT%'
what is solution to this?
View 7 Replies
Jan 20, 2011
Developing in C#.I have a home page and couple of other aspx pages.In the home page in a summary box I have names of projects. When the user clcks on a given project I will pass the projectID to the Project.aspx page.I then retrieve this ProjectID and display the project details in text boxes. Code is given below.
[Code]....
View 3 Replies
Jun 3, 2010
I'm trying to have a parameter as optional i.e. /Category/{ProductName}/{ProductOption} where ProductOption is optional. How do I handle this in web forms 4? Here's what my code looks like now:
[Code]....
View 3 Replies
May 27, 2010
I would like to have two different welcome pages for a site.How could I handle this? I've looked at routing but I'm not sure if global.asax.cs is the correct place to place this into.
www.mycompany.com should display generic information. Displaying view Home/Default.aspx
www.mycompany.com?id=1 should display welcome customer x. Displaying view Home/Welcome.aspx
View 2 Replies
Oct 22, 2010
I have got a drop down list in a gridview and would like to pass eval() as parameter to javascript..
<asp:DropDownList ID="ddl_grprowcutter" runat="server" onchange='<%# "fn_ddl(" +Eval("Order_No") + " );" %>'
View 15 Replies
Jan 20, 2010
how to pass through a query string parameter of an assignment id and then checking and validating this as a number and displaying the information returned on screen. At present I have code which displays the information on screen but this is by entering in the assignment id and by triggering the button click event, I've shown the code for this below:
.aspx
<div>
<b>Current Assignment</b>
<br />
<asp:TextBox runat="server" ID="txtAssignmentID"></asp:TextBox>
<asp:Button runat="server" Text="Get Assignment" />
<br />
<b>Date Started:</b> <asp:Label runat="server" ID="lblAssignmentStart"></asp:Label>
<br />
<b>Status:</b> <asp:Label runat="server"></asp:Label>
<br />
<b>Current Achievement Level:</b> <asp:Label runat="server" ID="lblAssignmentLevel"></asp:Label>
<br />
<b>Date Last Calculated:</b> <asp:Label runat="server" ID="lblAssignmentCalcDate"></asp:Label>
<br />
</div>
.cs
protected void cmdGetAssignment_Click(object sender, EventArgs e)
{
//Check the assignmentID is an integer
int AssignmentID = 0;
try
{
AssignmentID = TypeConv.CInt(txtAssignmentID.Text);
}
catch
{
}
if (AssignmenttID > 0)
{
//Create new TCAAssignment object by passing the ID
TCA Assignment Current Assignment = abc.TCA Assignment (AssignmentID);
lblAssignmentStart.Text = Current Assignment.dDateCreated.ToString();
lblAssignmentStatus.Text = CurrentAssignment.rTCAAssignmentStatus.dDescription;
if (!CurrentAssignment.dTCAAchievementLevel.IsNull)
{
lblAssignmentLevel.Text = CurrentAssignment.rTCAAchievementLevel.dDescription;
}
lblAssignmentCalcDate.Text = CurrentAssignment.dAchievementDate.ToString();
}
}
Code example passing through a query string parameter of an assignment id would be great.
View 11 Replies
Jan 12, 2010
call the method by passing parameter:
add_ddl_item_by_dt((DataTable)Session["dt_1"],ddl_1);
add_ddl_item_by_dt((DataTable)Session["dt_2"],ddl_2);
protected void add_ddl_item_by_dt(DataTable dt,DropDownList ddl)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
ddl.Items.Add(dt.Rows[i]["Field_1"].ToString());
}
}
why i cannot use the above method to add item to different dropdownlist by passing different parameter?
View 3 Replies
Mar 26, 2011
i am passing two parameter in javascript and open popup window.... but geeting mid value "undefined" here is my code:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>'),('<%# Eval("milestoneserial")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id,mid)
{
window.open("replymilestone.aspx?id="+id+"&mid="+mid,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
this is working fine if i am passing single value like:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id)
{
window.open("replymilestone.aspx?id="+id,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
View 1 Replies
Mar 16, 2010
i am using data grids on my web page, and on edititemtemplate i have custom validators for the drop down list ( ddl), most of them they do the same job which is to test if the user did select from the ddl or not.
i want to point all of these drop down lists to the same function and pass to this function the ddl.ClientID
how can i do this?
i tried this but it didn't work with me
[Code]....
[Code]....
[Code]....
View 2 Replies
Apr 7, 2010
I have a web form that has drop down controls. These controls are data bound to a database. Now, I would like the results of the selected values to be shown on a new aspx page in a gridview or detailsview.
View 3 Replies
Nov 25, 2010
how to passing dropdownlist value as parameter to another page?
View 3 Replies
Jun 15, 2010
I am using VS 2005 (asp.net 2.0). Currently i am facing a problem everytime onclick button call the popup it will refresh the page. Below is my code, Any suggestion or better idea can do it without refresh
[Code]....
View 2 Replies
Apr 26, 2010
input type=..... value="<%= ISO3166CountryList.GetCountryByCode("IE", CurrentLocale).Name %>" />
I'm looking to replace the hardcoded IE with something like
<%#(Container.DataItem as PhoneNumber).ISO%>
No variations of what I've tried worked. How can I get a databinded value when within a <%= code block? Do I need to use an intermediary variable?
View 2 Replies
Aug 26, 2010
I am using url in my mvc application like /product/edit/5, should change it because users can
change id parameter and access different product as this Id directly refer to Id in product table, I have validation there for user to access product.
should I continue with it or should I change it as application has many users
View 2 Replies
Oct 4, 2010
Passing dynamic value to Detail view of grid through object selecting parameter
View 4 Replies
Mar 23, 2011
When I try the following:
[Code]....
I get an error saying No overload for Add method takes 2 arguments. HOw would i pass the PaycheckID in then as a paramter?
View 2 Replies
Aug 23, 2010
I am new to ASP.NET, and was wondering how to pass a Page title through a parameter. In classic ASP I could just use something like:
<title><%=Pagetitle%></title> but I cannot seem to get this to work in ASP.NET.
View 3 Replies
Sep 8, 2010
public ActionResult RenderMyThing(IList<String> strings)
{
return View("RenderMyView");
}
How do I pass in strings?
routes.MapRoute("MyRoute", "RenderMyThing.aspx", new { controller = "My", action = "RenderMyThing" });
Is there a way I could pass in strings here?
Secondly, how does ASP.NET MVC know that action is my action, and controller is my controller. Like I saw this in samples, and it does work, but isn't it just an anonymous object with no type?
View 1 Replies