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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

what is wrong with the below simple code?

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net

in a button click I am trying to display a modal popup window
so in the ,cs side button1_click


But it is not displaying any thing on the button click. What is missing?


<style type="text/css">
              /*Olive; */

View Complete Post

More Related Resource Links

Wicked Code: Silverlight Page Turning Made Simple


As we'll show, with just a few lines of JavaScript you can build a general-purpose framework for incorporating page turns into Silverlight 1.0 apps.

Jeff Prosise

MSDN Magazine May 2008

Secure Habits: 8 Simple Rules For Developing More Secure Code


Never trust data, model threats against your code, and other good advice from a security expert.

Michael Howard

MSDN Magazine November 2006

Simple Captcha Code in Javascript

The article Simple Captcha Code in Javascript was added by miya2008 on Tuesday, June 29, 2010.

Here I create a Cptcha Code With JavaScriptStep 1:->In the (.aspx) page we write the following Code:->%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>!DOCTYPE

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!";
                case MembershipCreateStatus.DuplicateUserName:
                    this.CreateAccountResults.Text = "There already exists a user with this username.";
                case MembershipCreateStatus.DuplicateEmail:
                    this.CreateAccountResults.Text = "There already exists a user with this email address.";
                case MembershipCreateStatus.InvalidEmail:
                    this.CreateAccountResults.Text = "There email address you provided in invalid.";
                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

Help: Too many lines of code to achieve a simple goal: keep my NULL SQL values...


Hello all

What is the best way (best practice) to preserve my NULL SQL values in the database
during an insert/update operation (without receiving cast invalid errors)?
Also, how to display a string 'n/a' when a sql value is NULL?

My project is using FormView with Edit/Insert templates and classes to represent my tables

Goal1....: display 'n/a' when there are NULL SQL values in the database
Solution1: I am using ISNULL(field,'') in my store procedure for SELECT statements

Goal2....: if the fields are 'n/a', then save them back in the database as NULL
Solution2: on my insert/edit methods I am having to check the values being passed, i.e:

cmd.Parameters.Add(new SqlParameter("@scope", SqlDbType.NVarChar, 50));

if (item.Scope == "n/a")
 cmd.Parameters["@scope"].Value = DBNull.Value;
 cmd.Parameters["@scope"].Value = item.Scope;

Not to mention that for SQL DateType fields when you use ISNULL(field,'') the return string is '1/1/1900 12:00:00 AM'
and I have to change the field value in every field that represents a date, i.e:

protected void FormView1_DataBound(object sender, Sy


HI. I NEED LITTLE HELP. I have values 1000,2000,3000, wich located in numValue. Now I have sql table CUSTOM1 with column CUSTOM_ID where located numbers 1000,1001,2005,2006 .. Now if I choose( NumValue == 1000) go to sql table and find Maximum number wich begin with 1000 and add 1 = Result must be 1002 there is my code what change I must do in order to receive the num max + 1?       DataTable dt = new DataTable();         SqlConnection con = new SqlConnection("Data Source=DYS-PC;Initial Catalog=Veolia;Integrated Security=True");         SqlCommand cmd = new SqlCommand("Select Count(*) " + "FROM [MHGROUP].CUSTOM1 " + "WHERE CUSTOM_ALIAS = '" + comboBox2.Text + "'", con);         SqlDataAdapter sqlDa2 = new SqlDataAdapter();         sqlDa2.SelectCommand = cmd;         sqlDa2.Fill(dt);      

Data from text files, What's wrong with my code?

Hi all, I have uploaded some tab-delimited .txt files on my web site (actually run on my computer, ie localhost, for now), and now I try to retrieve the data from those files. I do this by calling a vb file containg the sub below. Everything works great, except that the sub won't recognise unicode characters. I can split the resulting string using vbnewline and vbtab, but already in the sub in question, the string doesn't understand the Swedish letters åäö, apostrophes and more. Any help would be greatly appreciated! /Pettrer       Shared Function getTextfile(ByVal FullPath As String, Optional ByRef ErrInfo As String = "") As String Dim strContents As String = "" Dim objReader As StreamReader Try objReader =New StreamReader(FullPath) 'UTF8Encoding? strContents = objReader.ReadToEnd() objReader.Close() ErrInfo = Ex.MessageCatch Ex As Exception End Try Return strContents End Function  

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 !

How could Transfer a simple object that is created in asp.net to java script code and worked with it


Hi Experts.

I have a simple call in asp.net code behind. There are two variable i, j and some methods in . Like:

Class Test()

{              int i; string str;

                Public getI(int){//.}

Public getJ(int){//.}


Is there any way to have the same class in javascript? I want to create a simple object form this class and initiated its variables and passed it to javascript code and worked with it? How can I do it?


How can i return a value from a simple WebForm.aspx to javascript code.


Hi Experts.

How can solve this problem; Suppose you write a simple JavaScript code in form tag like this:

<script  language="javascript">

                Var type="100";

                Var result = ';

Var iframe = '<iframe src="WebForm1.aspx?"t=' + type + '"></iframe>';

Document.write(iframe);           // call WebForm1.aspx in iframe tag

Document.write(result);            //write the result that return from WebForm1.aspx


I want return the value from WebForm1.aspx and save it in result variable. How can I do?How can i return a value from WebForm1.aspx and save it in result variable?

With Regards.Mojtaba

Annoying SQL exception, probably due to some OO/linq code done wrong


I started working on this "already started" project, and I'm having a really annoying error when trying to execute some interactions with SQL Server 2008:

The server failed to resume the transaction

One of these errors I get in this specific method call:

The aspx.cs Call:


busProcesso openProcess = new busProcesso(pProcessoId);
        if (openProcess.GetDocument() == null)
            //Irrelevant code.
    catch{ //... }

The Business class (relevant part):
public class busProcesso : IbusProcesso
        public Processo vProcesso { get; set; }

        RENDBDataContext db;

        public busProcesso()
            vProcesso = new Processo();

        public busProcesso(decimal pProcessoId)
            db = new RENDBDataContext();
                 vProcesso = db.Processos.SingleOrDefault(x => x.Id == pProcessoId);
            catch (Exception ex)
                throw new Exception(ex.Message, ex);

        public string GetDocument()

What's wrong with this code!?!?


I had a piece of code running that is fundamentally the same as the below except it uses temporary tables instead of nested queries. Is there something wrong with what I am trying to do? The one with temp tables works fine...


select category_a, category_b, count(customer_name) as instances, sum(spend) as spend 
select f.customer_name, category_a, category_b, 
case when category_a = category_b then a.spend else f.spend + j.spend end as spend
select customer_name, category as category_a, evidencedspend as spend
from fac_spendtest c join dim_customer d on c.customer_key = d.customerkey
join dim_product e 

Simple C# code does not work


Hi everyone,

How can I put the C# code into the htm file ? Then following
code does not work. How can I make it work ?



-------------- begin RSSTable.htm ---------------

ProductId = <%= Request.Params.Get("ProductId") %>

-------------- end RSSTable.htm ----------------

Very Simple JQuery code does not work


Hi everyone,

How come the following code does not work ?  If you can, please make the following code to work for me.



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CookiePage1.aspx.cs" Inherits="CookiePage1" %>

<!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">
<head runat="server">

    <script type="text/javascript">

        function SetCookie(T) {

            //Create (or update) the value of a cookie to expire in 2 days:
            $.cookie('ShoppingCartId', T, { expires: 2 });


        function ReadCookie() {
            var SCId = $.cookie('ShoppingCartId');

            return SCId;


        $(document).ready(function () {
            var T = "Testing Cookie";




    <form id="form1" runat="server">
    <div class="MyShoppingCartId">       

Exporting data that is in wrong code page in SQL Server



I have problem, when tryin to export data from SQL Server 2005 using Integration Services.

Sql Server has collation SQL_Latin1_General_CP1_CI_AS (code page 1252), but the actual data is encoded using code page 1257 (SQL_Latin1_General_CP1257_CI_AS). When I look the data using Management Studio, it is displayed wrongly, but when I convert the string to binary, I can see that bytes are encoded using code page 1257. I'm trying to read this data using SSIS 2005, but extended characters are always handled wrongly.

How should I read this data using SSIS?

My first assumption was changing DefaultCodePage to 1257 in my OLE DB Source component (also AlwaysUseDefaultCodePage to true). But without luck.

Also tried to convert data in my SQL Server query using COLLATE, but didn't work.

Is there something I could do to get it working?



All I see is the asp code, what am I doing wrong?


When I load up a .asp page, I just see the code.  How do I get the page to "run"?

Cheers Daniel.

incomplete Simple recursion code need help !!



hi every one !!

it a simple problem .... someone with good recursion  understanding can do it but i fail Frown

for example i have a datatable with following data

ID ------------------- Name ------------------- ParentID

1 ------------------- Home ------------------- null

2 ------------------- Course ------------------- null

3 ------------------- .Net ------------------- 2

4 ------------------- C# ------------------- 3

5 ------------------- VB ------------------- 3

6 ------------------- MCTS ------------------- 4

7 ------------------- MCPD ------------------- 4

8 ------------------- Contact ------------------- null


the data available in table is for my web navigation "Menu" bar

i have to fetch the records from table and add according to the parent/child link

like Course --> C # --> MCTS

currently i am able to add first layer of child like Course --> C # but unable to make correctly add "MCTS" as a child of "C#"

by using following code

void addmenu(

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