Binary Holding Boolean Values?
Jul 9, 2010
I have a 32 bit number in my DB/ DAL layer that is used to represent some yes/no facilities about hotels. so I for example bit might mean "has swimming pool", bit 2 might mean "reception desk" etc etc.Currently I have some code in the BLL that says if (number and 2) = 2 then .ispool = true - this is repeated for any many boolean hotel referances I have.What happens then is in the UI have then say something like if .ispool = true then display swimming pool icon.
Then it occurs to me that I am testing the value twice
1) To test the bin to bool in the BLL and create the structure
2) to test the structure to dislay the icon.
If I move the if (number and 2) = 2 to the UI I get the same result with one less if.Is there some better way or code do deal with this, maybe loop through the structure or something like that or an asp way that is more suitable to deal with binary representation of boolean's.
View 2 Replies
Similar Messages:
Aug 24, 2010
I have Check Box list in Asp.Net, contains week days like as (Monday to Sunday)
I want to store the checked values as 1, non checked values as 0, as Binary format.
Say for example: 0000011 (Monday ,Tuesday selected)
[code]
View 1 Replies
Jan 20, 2010
I'm having problems passing values from the controller to the view. I created a boolean variable to use as a flag and want the view to render some html based on whether its true or false.
Unfortunately ViewData doesn't look like it can pass boolean values. I should be able to pass any datatype to a view (string, int, bool, etc...)
View 16 Replies
Feb 17, 2011
I have an SqlDataSource, which is filtered by two RadioButtonLists. The markup is as follows:
[Code]....
In my code-behind I add the filterexpression when the radiobuttonlists are changed
[Code]....
My problem is that while it works fine when changing the RadioButtonListProducts the filtering works nicely, there is a problem with the RadioButtonListStatus, that filters on the Boolean column, 'Godkendt'. It works nicely if its set to 'Alle' (No filtering on that parameter) but when set to anything else, no records are shown. I suppose the problem is in the filterexpression
[Code]....
View 1 Replies
Jul 23, 2010
This is a bizarre behaviour I've just noticed, but very dangerous.I have the following line of code:
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["SmartFormsDB"].ConnectionString))
When I run in my dev environment works fine, but when I compile and push my code to the test machine that contains a web.config with a Test DB setting, the test website
still uses my dev connection string. It's behaving as if the connection string was compiled into the binary!
View 4 Replies
Sep 20, 2010
Is it possible to convert a datatable into binary data and save it into on a binary field on database?
View 2 Replies
Feb 3, 2011
I have a problem with deserializing in C#/ASP.NET, which gives the exact error:
The input stream is not a valid binary format. The starting contents (in bytes) are: 41-41-45-41-41-41-44-2F-2F-2F-2F-2F-41-51-41-41-41 ...
What I am trying to do
I have a structure with 3 classes. I have a class A which is a base class, and then class B and C which are derived from A.
I am trying to store random types of B and C in the database using LINQ to SQL, in a column with the type VARCHAR(MAX).
I cannot use BINARY as the length is around 15.000.
My code...
[code]...
So the error happends when the first Deserialize method is run, with the above error.
View 2 Replies
May 7, 2010
I using VS2005 asp.net 2.0 (VB.net).
I have a question. I have a Parent page (parent.aspx) In Parent page it will call a Pop Up page(pop.aspx) then choose the data from Popup's gridview pass back the data to parent page gridview.
I need an idea how to check/highlight the data which is already selected when user open the Popup again.
View 3 Replies
Aug 20, 2010
iam insert record using datable in gridivew,iam using session to hold the record, there is any other way to hold the record in datable.
[Code]....
View 1 Replies
Jul 2, 2010
I have a data editing application that I use the crystal reports viewer to generate pdfs on the client machine using exporttoHttpResponse that is working. My problem is that if a user adds a record, generates a report(pdf) then goes back and edits/updates the record and regenerates the report(pdf) it will show the older pdf. The updates don't show up. It is like the report is stuck in browser memory but if I clear the cache and history it still will not show the updated data. The only way I have found to show the updated data is to shutdown the browser and pull the record back up.
[code]...
View 2 Replies
Mar 26, 2011
I created asp.net application on alumni information database.After logged in it redirects to page i wish but the problem is the page i am redirected is not holding the user logged information. it just simply showing as annonymus user.
View 5 Replies
May 17, 2010
I need to do edit funtionality for registration forms (5 in number) in a trading system. Requirment is to do it in a way that user edit details in a form and click next or previous button and data will be saved somewhere until user reach last form and click save button. On this click all changes will be updated to database table. where I should hold this temporary data ? I cant use database tables for this. There come many options in mind like cach, session and application variables. But I am confuse which way will best performance wise. There are 5 forms and every form has 15 to 25 fields in it. I dont know expected no of users but hoping a good count.
View 8 Replies
Apr 22, 2010
We have an internal ASP.Net 3.5 application that opens Pervasive SQL databases, reads the data, and then closes the connection. Unfortunately, when the user exits the application, and even when they close their browser, the w3wp process seems to be holding the PSQL database connections open, which is causing licensing issues for us. I would like the w3wp process to release the database connections once the last user has exited from the ASP.Net application. How can I get w3wp to release the connections?
Someone told me that the Powershell command, "gps w3wp | kill" will stop the w3wp process. Is there any way I can automate this, so that the process will be killed automatically when the last user exits our ASP.Net application?
View 1 Replies
Nov 11, 2010
I hope somebody can guide me to overcome below challenge.
My form has three dropdownlist controls and one listview. Everything works fine if I don't try to pass multiple querystrings to get different URL on the same page. But challenge comes when I try to pass multiple querystrings to show different URL's for SEO.
Following are the ID's:
1. DropDownList1= Country
2. DropDownList2= State
3. DropDownList3= City
4. Listview1= Resturants (I am not including Code .....yet)
With my code DropDownList1 holds the state and passes the value to URL OK .When I try to select
different value in DropDownList2 or DropDownList3 are able to
pass the vaule to URL but in the form they stay on the first item and doesn't change and so does Listview1.
Here is my code:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (false == IsPostBack)
{
if (Request.QueryString["Brand"]!= null)
{DropDownList1.SelectedValue = Request.QueryString["Country"].ToString();}
if (Request.QueryString["Gender"]!= null)
{DropDownList2.SelectedValue = Request.QueryString["State"].ToString();}
if (Request.QueryString["Category"]!= null)
{DropDownList3.SelectedValue = Request.QueryString["City"].ToString();}
}
}
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect("/resturants.aspx?State=" + DropDownList1.SelectedValue + "&State=" + DropDownList2.SelectedValue + "&City=" + DropDownList3.SelectedValue);
}
</script>
<head></head>
<body><form id="form1" runat="server">
<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource2" DataTextField="Country" DataValueField="Country" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [Country] FROM [Country] ORDER BY [Country]">
</asp:AccessDataSource>
<asp:DropDownList id="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource3" DataTextField="State" DataValueField="State" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [State] FROM [table] WHERE ([Restuarant NAME] LIKE '%' + ? + '%')">
<SelectParameters>
<asp:controlparameter ControlID="DropDownList1" Name="Restuarant_NAME]" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
<asp:DropDownList id="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource4" DataTextField="City" DataValueField="City" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource4" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [City] FROM [table] WHERE (([State] = ?) AND ([Resturant NAME] LIKE '%' + ? + '%'))">
<SelectParameters>
<asp:controlparameter ControlID="DropDownList2" Name="State" PropertyName="SelectedValue" Type="String" />
<asp:controlparameter ControlID="DropDownList1" Name="Resturant_NAME" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
View 1 Replies
Feb 23, 2011
I have been googling this and have not come along a working solution for an entire day. I don't know anything about binary data types (as I've never knowingly used them) and I'm trying to write a binary value that I see in the registry, to the registry. Now, all I see is the following [shown below]... and if I try to pass that as a string to the RegSetValueEx in the WinAPI and of course it errors out... I do not know what 'numbers' I need to pass into the lpData As Any, argument of RegSetValueEx (i tried a bit array) in order for it to come out as the following [shown below] in the regedit. I really have no idea, and my tests to place random numbers in the bit array just produce corresponding random "figures" as visible in regedit that I do not understand how to 'tie' them together logically.
here is the culprit!
[Code]...
If I had the following in a string or a bit array, what must I populate the bitarray with so that the registry outputs this [above] when written? or, how can I figure out how to do it? I was hoping there'd be a function that reads my string of binary data and transforms it into the real binary format to submit to the RegSetValueEx function in VB6 or other function in VB.Net or C# (this really is a language agnostic question, and the problem exists in all languages; ie: same process).
View 2 Replies
Apr 27, 2010
I am using Visual Studio 2008. I have created a login screen and when user enters invalid userid or password, I am displaying error message in label by checking the database.
I am clearing the label, txtUserName and Password on click of Refresh button. But still the label message is appearing because UserName and Password controls are not clearing
View 4 Replies
Feb 6, 2014
I have developed a web application in Asp.net with C#. My requirement is to add an extra property to textboxes in all forms. The property should be "SID". I don't want add an exterban control i want to add extra property with the available textbox.
View 1 Replies
Sep 27, 2010
It is possible to convert string to boolean?If it is plz give me example
View 2 Replies
Jan 5, 2011
I am writing a bit of code to store about 100 (yes/no) answers about hotels. I have about 7000 records so I need to try and get this right the first time.At the min I have 4 * int32 values stored in SQL and I use a structure containing names boolean values like swimming pool, bar etc etc. In my BLL I have a method that tests the bits in the int 32 and sets the boolean value to try or false.
I have not had any problems with this way, but was thinking about the performance as this would currently have with about 100 if statements in the BLL to set all of the boolean values.The only other ways as I see it are..
1) have 100 boolean columns in the sql table, which I feel would be messy.
2) to have all the int32 sql values populate another text field that is stored in the DB so that the int32 value creates a text string when the hotel owner populates the click boxs in the first place. - then I just display the text value which would have been created something like "pool, bar" My way of lots of ifs does work, I was just worried about the performance
View 2 Replies
Mar 3, 2011
I am with MVC 3 validation code for a checkbox field that I can't seem to get to work. I'm looking for feedback to what might be wrong or if I am going about this a totally wrong way. I have searched for this error and as a beginner I think I am more turned around than when I started.
[code].....
View 12 Replies
Mar 7, 2011
I have this code I am trying to send one more bool value to the URL..
and its goign to the ActionResult Perfectly
public virtual ActionResult Index( int? id,bool? check ) {
}
But check allways geting null value?
is that something I am doing wrong?
View 2 Replies
Feb 26, 2011
I have a registration form which is working perfectly well, I need to enhance it slightly from where it is. As it is users are able to register for an account wether the email has been previously used/allocated in the user db.A client side call to the IsEmailAvailable function works great, just not working correctly server side. Here is the code.
My function:
[Code]....
And my if statement:
[Code]....
So my question is, how can I pass the end value of the IsEmailAvailable function to my if statement correctly.
View 4 Replies
May 15, 2010
FeatureEvents.bit_Activate = Convert.ToBoolean(collection["bit_Activate"]);
bit_Activate is checkbox ,how would i convert it to boolean above,collection is coming from the formcollection variable
View 4 Replies
Apr 1, 2010
i am working an asp.net mvc 2 web app using model metadata, templates and client side validation using jquery. I have noticed that the boolean and datetime fields of my model are treated as required from the model metadata, even though i haven't applied any Required attribute on them. This is not a problem for server side validation, but when using the client side validation (<%Html.EnableClientValidation(); %>) on my edit model page, the validation fails and i cannot post the model changes. Specifically, when setting the boolean property to unchecked (false), the validation fails and the "Field is required" message appears.
The only workaround i have found so far is to override the default Editor templates for my models and write my own.
View 9 Replies
Sep 20, 2010
I had my ASP.NET MVC actions written like this:
//
// GET: /TaxStatements/CalculateTax/{prettyId}
public ActionResult CalculateTax(int prettyId)
{
if (prettyId == 0)
return Json(true, JsonRequestBehavior.AllowGet);
TaxStatement selected = _repository.Load(prettyId);
return Json(selected.calculateTax, JsonRequestBehavior.AllowGet); // calculateTax is of type bool
}
I had problems with this because when using it in jquery functions I had all sorts of error, mostly toLowerCase() function failing.
So I had to change the actions in a way that they return bool as string (calling ToString() on bool values), so that thay return "true" or "false" (in the qoutes) but I kinda don't like.
How others handle such a case?
View 1 Replies