Use "true" Or "1" For Boolean Querystring Parameters?
Feb 1, 2010Does anyone use "true" or "false" when setting a query string param for a bool? or do most people use "1" or "0".
View 6 RepliesDoes anyone use "true" or "false" when setting a query string param for a bool? or do most people use "1" or "0".
View 6 RepliesI have an asp:label field for and expire date that should either display "Never" if the database field ([msDS-UserDontExpirePassword] this is a bit - true/false - field) is True, or otherwise display a date (pwdExpireDate).
My code doesn't throw any errors but I can' fully test it without putting it into production. Can someone tell me if this is correct? Also, there is no code-behind and I can't use code behind for this.
Here's the code:
The label: <asp:Label ID="lbUserPWExpireDate" Text='<%# ((bool)(Eval("[msDS-UserDontExpirePassword]"))==true ? "Never" : Eval("pwdExpireDate", "{0:M/dd/yyyy}")) %>' Runat="Server"/>
The query: <asp:SqlDataSource ID="GetUserExpireDate" runat="server" ConnectionString="<%$ ConnectionStrings:USER_PREFERENCESConnectionString %>" SelectCommand="SELECT DATEADD(day, 59, pwdLastSetDateGMT) AS pwdExpireDate, [msDS-UserDontExpirePassword] FROM LDAP_Users WHERE mail = @USER_EMAIL_ADDRESS" OnSelecting="GetUserExpireDate_Selecting"> <SelectParameters> <asp:SessionParameter Name="USER_EMAIL_ADDRESS" SessionField="USER_EMAIL_ADDRESS" /> </SelectParameters></asp:SqlDataSource>
I have a datagrid control, the first column is Revno, currently presenting info in linkbutton. i want to do a condition based on another field docid, which gets true or false value from database. if true then present Revno in linkbutton otherwise show the revbnno just as a label., thatway users does'nt have ability to clickit.
<ItemTemplate>
<asp:LinkButton ID="lblRevision" runat="server" CssClass="Textboxes" Text='<%# DataBinder.Eval(Container.DataItem, "RevNo")%>' CommandName="FileDownloadRecord"></asp:LinkButton>
</ItemTemplate>
this docid field has flag true or false.
if true meaning show the revno as LinkButton, otherwise show the revno as label.
GetDocdetail(DataBinder.Eval(Container.DataItem, "Docid")
on the codebehind side i can use this function.
Public Function GetDocdetail(ByVal DocID As boolean) As String
If DocID = "true" Then
Else
End If
End Function
I have two examples to show you what I want to achieve here. But to point what's different about my question, Is that I'm having a parametrized URLs and I want to implement URL rewriting to my application. But I don't want to convert the parameter in the URL to be placed between slashes..."page.aspx?number=one" to "pages/one/" << NOT!
First example:
http://localhost:1820/Pages/Default.aspx?page=2&start=5
To
http://localhost:1820/Pages/page2
Second example:
http://localhost:1820/Items/Details.aspx?item=3
To
http://localhost:1820/Items/ItemName
But I'll still need all the parameters in the original URLs
I try to have an URL like this /Forum/Index/2 for url I have a route {controller}/{action}/{page} in my global.asax
If i test the above url with the Route Debugger it corresponds to the above route ( and some other but this is the fist one in the list ) but if I create an url with the ActionLink
( like this : [Code]....
),
this methode return me this URL /Forum/Index?page=2 Is there a way to a have an url with nothing in querystring with the ActionLink methode ? Gauthier
I wanted to ask about URL rewriting. I want to map this: [URL]
To: [URL] Being DVD players product id 123.
Also I will like to map sub domains like this:
From: [URL]
To: [URL]
Being John Doe user id 123. I will like to do this by getting the respective ID (for products and users) from a database based on product id name (dvdplayers) and sub domain name (johndoe). Where can I intercept these 2 (sub domain string and product name string) and based on this getting the info from DB and "rewrite" the URL's?
How can I pass two querysting parameters in URL routing using ASP.NET 4.0? I have gone through many articles, but everywhere it shows only one parameter. I'd like the display URL to be: [URL] The first parameter is ID: 1 The second is Name: This is my first report I am trying following route, but it is not working
routes.MapPageRoute(
"MarketReports", // Route name
"Reports/{*i}-{*n}", // Route URL
"~/pageControl2.aspx" // Web page to handle route
);
How can I make this work as described?
I am using a third party service that does an async callback to a URL I provide to them. So I tell them to use [URL] This must obviously map to an Incoming() method on my StatusController.
However, what I don't have control over is the format of the parameters they call my URL with. E.g. They will do a callback such as: [URL] I want to map this to the parameters of my action method: Incoming(string param1, string param2, int param3)
How do I do this?
My querystring has 2 parameters say pm1 and pm2. I want to check the value of each and if the value if '1' then pop open a new window(one for each parameter) and the url for the two windows will be different.
View 2 RepliesWhich is the best way (in performance and security) to send multiple parameters to a web page (on a different server), considering that the length of the parameters may vary because I'm sending a list of products, and the customer may have selected more than one product, so we need to send each product on the querystring to the other page. For example (I'm on C#); I want to call a web page like this:
Simple Querystring: thepage.asp?Product=1&Name=Coffee&Value=1.99
Json: thepage.asp?{"Product":"1","Name":"Coffee","Value":"1.99"}
XML: thepage.aps?<xml><Products><product>1</product><name>Coffee</name><Value>1.99</Value></Products>
(Obviouly considering we can't send special characters via querystring, but I put them here for better understanding) Which will be the better way (performance, security)?
I'm working on an online payment store, where users would pay by their credit cards to buy stuff. After they paying, master card website would return them back to my website, and sending back some params as querystrings like this http://mywebsite/done.aspx?param=1¶m2=2.
View 4 RepliesWhat's wrong with this code?
Source page : Default.aspx
[Code]...
How do I delete or change a query string with codebehind, VB.
View 2 Repliesi have a query string as follows
http://localhost/SampleAppl/Pages/SampleTest.aspx?State="SUBMIT"&Fields="{{label='Acc Nbr 1:',Id='1001',mask='F'},{ label='Acc Nbr 2:',Id='1002', Value='Second
Account', mask='F'},{ label='Acc Nbr 3:',Id='1003', Value='Third Account', mask='F'}}"
i want to get the parameters in my page load event (language as C#). i dont know how the get the values for "Label", "ID", "Value" and "Mask" from the query string. all the data need to be put on the array like LabelArr, IDArr, ValueArr and MaskArr.
I'm using the iis7 URL Rewrite module and it's working fine, except for two things. Being new to this, I might be missing something obvious.
1) My URL gets converted from www.mysite.com/search.aspx?fName=John&sName=Smith to www.mysite.com/John/Smith. This works fine, but if I add a trailing / , a few images on the site disappear, wheras a few don't. (They're all in the same location). However, the search results are fine.
2) Is it possible to make cerain querystrings optional? Server side, this is implemented (i.e. if nothing is entered, then assume a default value). But how would this work with the URL rewrite module? e.g. www.mysite.com/John would search for John and use a default value for the sName parameter.
I've been rewriting a static site into a data driven version, and I want to do away with a specific page for custom errors. Is this possible?
eg:<customErrors mode="RemoteOnly" defaultRedirect="dynamic.aspx?w=1&p=5" />
When I run a page using the above config file, I get an error saying The requested page cannot be accessed because the related configuration data for the page is invalid. (it doesn't like the ampersand in the address)
I need to get a querystring in a select parameter
datasource.selectparameters.add("PostId", request.querystring("PostId"))
Something like that...but...i cant get the snytax right.
According to below link
Encrypt-and-Decrypt-QueryString-Parameter-Values-in-ASPNet-using-C-and-VBNet.aspx
Here write code for button and textboxes
protected void Submit(object sender, EventArgs e)
   {
       string name = HttpUtility.UrlEncode(Encrypt(txtName.Text.Trim()));
       string technology = HttpUtility.UrlEncode(Encrypt(ddlTechnology.SelectedItem.Value));
       Response.Redirect(string.Format("~/CS2.aspx?name={0}&technology={1}", name, technology));
   }
But I used hyperlink and used it in datalist that bind from database...
How can IÂ Encrypt Gridview HperlinkField .
View 1 RepliesI want to dynamically populate a link with the URI of the current request, but set one specific query string parameter. All other querystring paramaters (if there are any) should be left untouched. Eg, imagine I want to build a link back to the current page, but with the querystring parameter "valueOfInterest" always set to be "wibble" (I'm doing this from the code-behind of an aspx page, .Net 3.5 in C# FWIW).Eg, a request for either of these two:
/somepage.aspx
/somepage.aspx?valueOfInterest=sausages
would become:
/somepage.aspx?valueOfInterest=wibble
And most importantly (perhaps) a request for:
/somepage.aspx?boring=something
/somepage.aspx?boring=something&valueOfInterest=sausages
would preserve the boring params to become:
/somepage.aspx?boring=something&valueOfInterest=wibble
Caveats: I'd like to avoid string manipulation if there's something more elegant in asp.net that is more robust. However if there isn't something more elegant, so be it. I've done (a little) homework: I found a blog post which suggested copying the request into a local HttpRequest object, but that still has a read-only collection for the querystring params. I've also had a look at using a URI object, but that doesn't seem to have a querystring
Below is my query string my page name is stored in data base when I am using without querystring its working fine, but when i am adding query string to it, its giving me error.. below is my code
<a href='<%# "Eval("DetailedPage")?ID="+DataBinder.Eval(Container.DataItem,"ID") %>'
style="text-decoration:none; font-size:small; color:#22BCE5; font-weight:bold">View More...</a></td>
Error I am getting is
 ) expected
at line
<a href='<%# "Eval("DetailedPage")?ID="+DataBinder.Eval(Container.DataItem,"ID") %>'
style="text-decoration:none; font-size:small; color:#22BCE5; font-weight:bold">View More...</a></td>
In one of the web page say "Default1.aspx" I have a Gridview.I am using 2 DataKeyNames in Gridview. i.e., DataKeyNames="G_Name, Param_ID" Also, I have one Hyperlink inside Gridview, upon clicking, page navigates to other page say "Default2.aspx"
code of "Default1" page:Â
<asp:GridView ID="GridView1" runat="server" DataKeyNames="G_Name, Param_ID" AutoGenerateColumns="False" Width="100%" PageSize="8" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging">
<Columns>
<asp:BoundField HeaderText="Goal Name" DataField="G_Name" Visible="false"/>
[Code]....
code of "Default2" page:
protected void Page_Load(object sender, EventArgs e) {
if (!Page.IsPostBack) {
string name = Request.QueryString[0].ToString();
string id = Request.QueryString[1].ToString();
}
}
I want to pass multiple parameters in querystring. I wrote above code.
Problem is: I am unable to write the correct syntax for Hyperlink NavigationUrlTherefore, it is giving me below error:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'GF_Name, Param_ID'.
at Line:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("GF_Name, Param_ID","~/Default2.aspx?Name={0}&Id={1}") %>'
Text='<%# Eval("GF_Name") %>'></asp:HyperLink>
how to resolve it.
This is House_p table
behcode subset classification model description image name Id
2222 furniture sofa sofa test 1.jpg sara 1
I currently have the following ActionFilterAttribute:
[Code]....
No matter the code, the point is that when I use the Filter in my controller, I need to pass in values for both "mem" and "redirect", but I don't know the syntax. All examples I've seen only use one parameter. Is there any way to use more than one or should I revise to a different strategy? As an example, I currently use:
[Code]....
where m is an instance of WBMembership. If I tried to add ",redirect=true" inside the (), I get an error.
It took me a little while to figure this out, but the AllowPaging="true" on the FormView seems to be the culprit. I don't have much experience paging from a FormView, but for this requirement the customers wants this kind of UI.I have a FormView with DefaultMode="Edit", which is bound to an EntityDataSource. One of the entity's properties, "ExternalID", determines whether some of the other properties in the entity are read-only. For example, if IsExternal==null, the FirstName, LastName, and Email fields should be rendered as TextBoxes. If IsExternal!=null, the 3 properties should be rendered in Label controls.
View 2 Replies