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


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

Why is the code not work?

Posted By:      Posted Date: September 11, 2010    Points: 0   Category :WPF
 
Hi to all. Why is the code not work? In this code I take the Value (object from class) and transfer it to Store Procedure but before I check if the ClientData.CompanyCode == null  transfer to SP null else transfer the value in the  "CompanyCode" cmd.Parameters.Add( new SqlParameter("@Corporation_code", ClientData.CompanyCode == null ? DBNull.Value : ClientData.CompanyCode)); there is not my code than I don't very well understand this code. Get this error : Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DBNull' and 'string'


View Complete Post


More Related Resource Links

C++ at Work: Managed Code in Visual Studio 2005

  

Many of you are no doubt in the process of upgrading to Visual Studio® 2005, so I thought now would be a good time to relate some of my own experiences with the new compiler. What took me so long? Hey, I'm a retro kind of guy! Better late than never!.

Paul DiLascia

MSDN Magazine June 2006


Sharepoint: In Calculated Column, Code with multiple "IF" condition does not work.

  
Implemantation:  Calculate expected resolve date exclude "Saturday" and "Sunday"  based on Priority and Severity.Columns are:1. Priority:2. Severity:3. Raised on: Date record createdCode: Below is the code which contains multiple "If" conditions. For quick undersatnding, i separated major If condition. Below code does not work and sharepoint gives me Sytax error message. =IF(OR(Priority="Critical",Severity="Critical"),IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+3,[Raised on]+1),     IF(OR(Priority="HIGH",Severity="HIGH"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+4, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+4,[Raised on]+2)) ,   IF(OR(Priority="MEDIUM",Severity="MEDIUM"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+5, IF(TEXT(WEEKDAY([Raised on]+3),"dddd")="Saturday",[Raised on]+5,[Raised on]+3)) ) ,   IF(OR(Priority="LOW",Severity="LOW"), IF(TEXT(WEEKDAY([Raised on]+1),"dddd")="Saturday",[Raised on]+6, IF(TEXT(WEEKDAY([Raised on]+2),"dddd")="Saturday",[Raised on]+6, IF(TEXT

Looking for .net people in the USA to talk to on Live Messenger during work hours... talk code.. ide

  
Im not sure this is the right place to ask but ill give it a try. If theres a better place for this someone let me know please anyways. I am a .NET dev and would love to have a couple people int/adv level .net devs I could IM a question regarding .NET things I am working on.. not 'do this for me please!' questions but Id want to ask more general ways to go about doing things and just conversation fun talk about coding ideas .. I am the only dev at work so it is lonely not having anyone I can ask questions to.. so if anyone would like to chat add me on Live messenger (punkouter@hotmail.com)

How can I make this code work?

  

I have this code it is work almost correctly but now this code populated data to ALL comboboxes at the time(in the start of UI) the User open the UI.

I need to split the code so when the User select value in combobox corporationCode1 I will advance to combobox WorkSpaceCorporation

for some like this if user select something in combobox CorporationCode1 so advence to combobox WorkSpaceCode..

There is a code/

private void Window_Loaded(object sender, RoutedEventArgs e)

        {

    

Why my checkbox override does not work ? ( code attached )

  

I try to create 3 state button. This control will will change the image on each of those 3 state ( normal, pressed, mouseOver ). The images of each state will be define as a property from the c# code ==> that mean i will be able to re-use this code and change the properties of the image source.

 

<CheckBox x:Class="StateButton.StateCheckBox" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:mc=

Gridview row sometimes has to be selected twice for code to work

  

I'm using the code below to extract data from a gridview and populate it into textboxes for the days and two drop downs for Project and Category.

For some rows in the gridview everything but the category ddl populates correctly. If I click the row a second time the category ddl displays the correct category.

Can anyone tell me why I have to click twice for some rows? And how do I fix this?

Thank you


protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
    //// Get the currently selected row using the SelectedRow property.
    GridViewRow row = GridView1.SelectedRow;

    txtSunday.Text = (row.Cells[6].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtMonday.Text = (row.Cells[7].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtTuesday.Text = (row.Cells[8].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtWednesday.Text = (row.Cells[9].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtThursday.Text = (row.Cells[10].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtFriday.Text = (row.Cells[11].Controls[0] as DataBoundLiteralControl).Text.Trim();
    txtSaturday.Text = (row.Cells[12].Controls[0] as DataBoundLiteralControl).Text.Trim();

    // Set ProjectList ddl to Project in selected row
    if (ProjectList.Items.FindByText

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 ?

Thanks,

Cecilia

-------------- 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.

Thanks,

Cecilia

<%@ 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">
    <title></title>

    <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";
            SetCookie(T);

            $('.MyShoppingCartId').append(ReadCookie());

        });       

</script>

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

Code that works in WebDAV does not work when deployed to IIS7

  

Hi

I have been working on a solution that:

1. Connects to a Lotus Domino server to retrieve data from the .nsf file

2. Uses NotesSQL Driver 8.0 (I've tried both System DSN and ConnectionString method)

3. When I view the page using VS 2008 own's WebDAV to test run, it works flawlessly.  Database can be connected and so Data was retrieved successfully. 

However, when I deployed the website to IIS 7, it gives me problem:

Following is the stacktrace from the Event Viewer entry:

Log Name:   Application
Source:    ASP.NET 2.0.50727.0
Date:     02/11/2010 5:04:07 PM
Event ID:   1309
Task Category: Web Event
Level:     Warning
Keywords:   Classic
User:     N/A
Computer:   KITWILLIAM.naim.com
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 02/11/2010 5:04:07 PM
Event time (UTC): 02/11/2010 9:04:07 AM
Event ID: 0ec2d703a5884f92be87faf06f746c00
Event sequence: 4
Event occurrence: 1
Event detail code: 0
 
Application information:
  Application domain: /LM/W3SVC/1/ROOT/Resrc-4-129331622441589373
  Trust level: Full
  Application Virtual Path: /Resrc
  Application Path: C:\inetpub\wwwroot\Resrc\
  Machine name: KITWILLIAM
 
Process information:
  Process ID: 2644
  Process name: w3wp.exe
  Account name: NT AUT

Convert code for GridView to work in DetailsView

  

Can anyone help me out please ?  I want this code to work in a DetailsView -


protected void gvContacts_RowDataBound(object sender, GridViewRowEventArgs e)
    {       
        if (e.Row.RowType.Equals(DataControlRowType.DataRow))
        {
            DropDownList ddlGroupName = (DropDownList)e.Row.FindControl("ddlGroupName");
            Label lblGroupName = (Label)e.Row.FindControl("lblGroupName");
            lblGroupName.Text = ddlGroupName.SelectedItem.Text;
            ddlGroupName.Visible = false;
        }       
    }

Thank you in advance


Code working in XP / 32 bit won't work in Win 7 / 64 bit - "Input string was not in a correct forma

  

I'm working on a program in VS 2008 / XP 32 bit. So far everything has been working
fine in both XP 32 bit and Win 7 / 64 bit - until I introduced the following piece of
code:


        private void DateFilter()
        {
            // strDate = "MM/dd/yyyy";

            // convert strDate to yyyyMMdd
            strConvYear = strDate.Substring(6, 4);
            strConvMonth = strDate.Substring(0, 2);
            strConvDay = strDate.Substring(3, 2);
            strConvDate = convYear + convMonth + convDay; // yyyyMMdd
            intConvDate = Convert.ToInt32(strConvDate);

            // convert DateTimePicker (dtpSortDates) format yyyy-MM-dd to yyyyMMdd
            intDtpSortDates =
      

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

RadioButton inside GridView, How to get it work as normal

  
Did you tried before to drag a RadioButton control inside a Gridivew templatefield, and then you attempt to select these RadioButtons , you will notice that the behavior of RadioButton control will be changed and it will work just like the behavior of checkbox control! the user will be able to select more than one radiobutton in the grid!
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