.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Post New Web Links

Whats wrong with this condition

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
 
I have this condition in my page_load event and it seems to be ignored, i do have it OUTSIDE of my !IsPostback condition. I need to check those sessions EVERYTIME you get to the page, regardless if its the first time on the page or if you have been on the page / site for a while.. those sessions are being set on a different page and this particular page needs those variables in order to work.. so if they dont exist they need to be sent back to the first page so they can be set.   if (Session["ss_t_id"] == null || Session["ss_t_type"] == null) { Response.Redirect("/", false); } ============================================== if (!IsPostBack) { ddlReport.SelectedIndex = 1; if (ddlReport.SelectedValue == "0") { lvReport.Visible = false; filterddl.Visible = false; prtPage.Visible = false; prtAll.Visible = false; } else { DropDownLists are being set in this portion } }  


View Complete Post


More Related Resource Links

Whats wrong with this statement

  

Im trying to updated some old ASP pages with some new .net pages and cant seem to get this update statement to work. I need to update the current ASP code below and then once thats working im going to use that same statement in a procedure for all our new .Net pages..

So can anyone see what im doing wrong by inserting the 2nd column to the update statement?

strSqual = "update tas set date_completed='" & TransDate & ", trans_id=" & InsertedTransID & "' where date_completed is null and sercontract_id="& strContractID & " and DATEDIFF(dd,task_due_date,'" & strProcDate & "')<=14"

 

I am trying to add an extra column to the update, but not sure if the syntax is correct.

Whats wrong with this code, im getting blue line under the createStatus next the switch

  
Error message: Use of unassigned local variable 'createStatus'
 
            MembershipCreateStatus createStatus;
            MembershipUser newUser = Membership.CreateUser(Username.Text, Password.Text, Email.Text);

            switch (createStatus)
            {
                case MembershipCreateStatus.Success:
                    this.CreateAccountResults.Text = "The user account was successfully created!";
                    break;
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                    break;
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                    break;
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                    break;
                case MembershipCreateStatus.InvalidPassword:
                    this.CreateAccountResults.Text = "The password you provided is invalid. It must be seven characters long and have at least one non-a

Whats wrong with my ExecuteScalar() Code ? - C#.net - Plz Help !

  
Hi,I downloaded OracleHelper & i'm using it....Now i want to insert a row into a table named 'Sample'.I have 2 textboxes and when i click on the button i need to insert the values from 2 textboxes into the table & here is my code....OracleHelper.ExecuteNonQuery(connectionString, CommandType.Text,"insert into sample (id,name) values(?id,?name);", new OracleParameter("@id", OracleDbType.Int32, Int32.Parse(TextBox1.Text)), new OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString()));The error i get is,ORA-00911: invalid character and it shows the error is innew OracleParameter("@name",OracleDbType.Varchar2,20,(TextBox2.Text).ToString())Please guide me !

Whats wrong with my style?

  
Im getting a compile error "Error 6 '12' is not a valid value for the 'System.Windows.Documents.TextElement.FontSize'" when I apply my style to a label.  It "looks right", I could use someone elses opinion what is wrong: <Window x:Class="MoneyClient.RevisedScreen" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:net="clr-namespace:System;assembly=mscorlib" Title="Revised Screen" Height="480" Width="600"> <Window.Resources> <net:Int32 x:Key="titleFontSize">12</net:Int32> <Style x:Key="headerStyle" TargetType="Label"> <Setter Property="FontSize" Value="{StaticResource titleFontSize}" /> <Setter Property="FontWeight" Value="Bold" /> </Style> </Window.Resources> <Label Content="Setup" FontSize="12" FontWeight="Bold" Style="{StaticResource headerStyle}"/> </Window> Thnx Mat

Suffereing with text formatting, whats wrong?

  
I am outputting a histogram and can't get the labeling of the cells formatted correctly. I want the numbers printed at the bottom of each cell to be centered, but as you can see they are left justified. At the same time the very left number I oversized to see what would happen. This widens the size of the graphic bin which I don't want, I would rather crop the number. What am I missing here, what attributes are missing? I have been playing with this since yesterday and it is driving me nutts. <hbox height="200" width="100" style="border: 2px inset -moz-dialog; margin: 4px;"> <box id="0" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 10%);">2900</box> <box id="1" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, red,red 11%);">3</box> <box id="2" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 12%);">1</box> <box id="3" flex="1" align="end" width="5%" style="background: -moz-linear-gradient(left, yellow,yellow 13%);">1</box> Etc </hbox>

Can anybody tell me whats wrong in this query?

  

Hi, this is the query for SsisConfiguration. i have done few changes in the main package so i have to change the data files path. Can anybody tell me if this is correct? i have 5 child packages so do i have to do the same thing for all packages?

USE SsisLogs

DECLARE
    @DATABASE VARCHAR(100)
 ,@SERVER VARCHAR(100)
 ,@SUBJECTAREA VARCHAR(100)
 ,@CONFIGURATIONFILTER VARCHAR(500)
 ,@CONFIGURATIONVALUE VARCHAR(MAX)
 ,@CHILDPACKAGEPATH VARCHAR(MAX)
 ,@CHILDPACKAGEPREFIX VARCHAR(MAX)

SET @SUBJECTAREA = 'PlanFinder'
SET @CONFIGURATIONVALUE = '\\uafc.com\ua\MH\DIRFILEDEV\CHG67570\Data'
SET @CONFIGURATIONFILTER = 'FileLocation_'+@SUBJECTAREA

IF  EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]
WHERE ConfigurationFilter = @CONFIGURATIONFILTER)
BEGIN
UPDATE SsisLogs.Audit.SsisConfig
SET ConfiguredValue = '\\uafc.com\ua\MH\DIRFILEDEV\CHG67570\Data'
WHERE ConfigurationFilter = 'FileLocation_RxCuiToNdc_Load'
END
IF NOT EXISTS (SELECT * FROM [SsisLogs].[audit].[SSISConfig]
WHERE ConfigurationFilter = @CONFIGURATIONFILTER)
INSERT INTO Audit.SSISConfig
(
 ConfigurationFilter
 ,ConfiguredValue
 ,PackagePath
&nb

Whats wrong with this SelectNodes string?

  

I can't fingure out what I'm doing wrong here.

This is a minimized version of how the XML looks like: 

<?xml version="1.0"?>
<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns="http://purl.org/rss/1.0/">
  <channel>
    <title> </title>
    <link>http://magicplus.karolinska.se/pc/driftrapportlista.asp</link>
    <description> </description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
        <rdf:li rdf:resource="http://magicplus.karolinska.se/pc/driftrapportlista.asp" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="http://magicplus.karolinska.se/pc/driftrapportlista.asp">
    <

Whats wrong with this syntax

  

I had issues with updating database with .xls  and .csv files, but got it working.. I need more control over the csv upload, so i was trying a few things i found online for connecting to the file similar to the excel file that works great.

 

I have the follow connections to an xls and csv and the csv logic throws an exception that it cant find the file, even though it was uploaded successfully prior to the reader.

Here is the logic for an excel file and then for the csv, both are identical except for the Extended Properties on the connectionstring, so not sure why its giving that error, the file is uploaded to the folder fine and exists prior to the reader.

{"'C:\\\\inetpub\\wwwroot\\SyNet\\TestSecurity\\Sion\\Sion\\Data\\testAPconfig.csv' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides."}

 

Connection String for .CSV

                            OleDbConnection csvConnection = new OleDbConnection();
                            csvConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                            "Data Source=" + fullName + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited;\"";

                          

sql server 2005 on windows 7 .. Whats wrong?

  

Hi ..

I downloaded Sql server 2005 on Windows 7 And downloaded Sp3  but it is just giving me the Configration tools without the Database Server ..

what the problem please??!!

if any one can help I will be so greatfull ..

Thanks..


whats wrong with this? decimal or whole number?!

  

here is my code, i am getting the data types wrong i think.

label 51 is a whole number from database, label52 could be a decimal number after the division is applied to label 51.

label 53 will be a decimal

label 54 will be a decimal, but id like to show it to the nearest whole number...

how can i get this to work? thanks!

FormView Formview1 = (FormView)sender;
        Label Label51 = Formview1.FindControl("Label51") as Label;
        Label Label52 = Formview1.FindControl("Label52") as Label;
        Label Label53 = Formview1.FindControl("Label53") as Label;
        Label Label54 = Formview1.FindControl("Label54") as Label;

        

        Label52.Text = (int.Parse(Label51.Text) / Convert.ToInt32("144")).ToString();
       Label53.Text = (double.Parse(Label52.Text) * Convert.ToInt32("100")).ToString();
        Label54.Text = (Convert.ToInt32("100") - int.Parse(Label53.Text)).ToString();



Whats wrong with my code?

  

CREATE

 

TABLE [dbo].[TABCPFRF_new](

[IdRegistro] [int]

IDENTITY(1,1)

Whats wrong with my code?

  

I´m trying to run the code bellow, but i get an error

 

sp_msforeachdb

 

' IF ''?'' IN (select name from sys.databases where name in (''Lote_5'', ''Lote_10'', ''Lote_1'') and state = 0)

BEGIN

USE ?

--drop table tabcpfrf_new

IF (EXISTS (select 1 from sys.objects

where name = ''PK_TABCPF_IdRegistro1''))

BEGIN

ALTER TABLE [dbo].[TABCPFRF_new] WITH CHECK ADD CONSTRAINT [FK_TABCPF_TABCODERRO] FOREIGN KEY([CodErro])

REFERENCES [dbo].[TABCODERRO] ([CodErro])

 

ALTER TABLE [dbo].[TABCPFRF_new] CHECK CONSTRAINT [FK_TABCPF_TABCODERRO]

 

ALTER TABLE [dbo].[TABCPFRF_new] WITH CHECK ADD CONSTRAINT [FK_TABCPF_TABLOTE] FOREIGN KEY([IdLote])

REFERENCES [dbo].[TABLOTE] ([IdLote])

 

ALTER TABLE [dbo].[TABCPFRF_new] CHECK CONSTRAINT [FK_TABCPF_TABLOTE]

 

ALTER TABLE [dbo].[TABCPFRF_new] ADD CONSTRAINT [DF_TABCPFRF_DtConsultaRobo] DEFAULT (ge

whats wrong with this query

  

please help..what's error here...I'm trying to do dynamic Pivot here, please help

CREATE TABLE #DataTbl (ACNAME VARCHAR(50), MONTHNAME VARCHAR(20), TOTALCOUNT INT, TOTALSALES INT)

INSERT INTO #DataTbl
SELECT 'XYZ', 'DEC', 10, 100 UNION ALL SELECT 'XYZ', 'JAN', 13, 300 UNION ALL SELECT 'XYZ', 'FEB', 14, 400
UNION ALL 
SELECT 'PQR', 'DEC', 2, 57 UNION 

Could some one tell me whats the Problem with this String Manipulation ??? C#.net

  

Hi.,

I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????


Wrong Account being used to access files - Help - No Impersonation

  

I run a simple .aspx website on a Windows Server 2008 machine.

There is NO impersonation, and System.Security.Principal.WindowsIdentity.GetCurrent().Name returns NT AUTHORITY\NETWORK SERVICE, which it the account which the application pool runs. In my web.config, I have <authentication mode="Forms">.

 

I tried to test the security of the application and server by removing file permissions to the .aspx files. I was greatly worried when the website continued to run without problem (it should not have been able to read the .aspx files).

By turning on file level auditing, I discovered that the .aspx files were being read by the machine$ account (if the machine is called Serv1, then the files would be read by the Serv1$ account, which seems to have access to all files on the local machine).

 

Is this a security breach or is this behaviour by design ?

Please can somebody assist, as I am worried.


how to multiple condition in if statement in asp.net C#

  

sir

i am using if condition to find out a time

if(time=="08 AM)

{

response.write"shift A";

}

but problem is how can i put multiple condition in if like

if(time=="06 AM" and "08 AM" and "07 AM")


Usability in Practice: When Things Go Wrong

  

This month our usability experts explain what it takes to create informative, useful error messages.

Dr. Charles Kreitzberg and Ambrose Little

MSDN Magazine January 2009


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend