Ramesh S 129 Posting Pro

.NET Framework: An integral Windows component that supports building, deploying, and running the next generation of applications and Web services.

Metadata: Information that describes every element managed by the common language runtime: an assembly, loadable file, type, method, and so on.

Manifest: An integral part of every assembly that renders the assembly self-describing. The assembly manifest contains the assembly's metadata.

Interoperability : Tools and techniques to interoperate between .NET managed code and unmanaged code include Platform Invoke services and .NET Framework and COM interoperability tools.

Abstract: Abstract classes act as expressions of general concepts from which more specific classes can be derived. You cannot create an object of an abstract class type; however, you can use pointers and references to abstract class types.

DangerDev commented: nice explanations. +2
Ramesh S 129 Posting Pro

You can use RegularExpressionValidator for accepting only four digits and RequiredFieldValidator for mandatory checking.

Hope this sample code will help you.

<asp:TextBox ID="txtPostCode" runat="server"></asp:TextBox>
    <asp:RegularExpressionValidator ID="regExpPostCode" runat="server" ControlToValidate="txtPostCode" ErrorMessage="Must be at least 4 digits" ValidationExpression="\d{4}">
   </asp:RegularExpressionValidator>
   <asp:RequiredFieldValidator ID="reqFieldPostCode" runat="server" ControlToValidate="txtPostCode" ErrorMessage="Post Code must be entered">
  </asp:RequiredFieldValidator>
Ramesh S 129 Posting Pro

Mark this thread as solved if your question is answered.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Use check constraints. A check constraint allows you to specify a condition on each row in a table.

Try this

CREATE TABLE YourTableName
( 
  column 1...,
  column2...,
  STATUS  numeric(1),
  CONSTRAINT check_status
  CHECK (STATUS IN (1,2,3)) 
);
Ramesh S 129 Posting Pro

You can have both XAMPP and VS & SQL Server in the same machine.

By default, IIS using port 80. Apache will also try to use port 80 when you install it.

To overcome this problem, Stop iis before the installation of apache.

You can assign port 80 to either apache or IIS.


To change apache's default port, goto httpd.conf in conf directory of installtion. Open it with editor and change
listen 80 to listen 8080 (or whatever port you wish)
servername -> localhost:8080. Save and restart apache server.

To change the default port number of IIS, Start->Run->Type inetmgr->Select Computer Name->Web Sites->Right click on Default Web Site>Properties

It will show Default Web Site Properties dialog box.
Under the Web Site tab->Change TCP Port to 8080 or something whatever you want.

Ramesh S 129 Posting Pro

1. Set the button's CommandName property to a string that identifies its function, such as "Insert" or "copy".

2. Create a method for the ItemCommand event of the control. In the method, do the following:

a. Check the CommandName property of the event-argument object to see what string was passed.

b. Perform the appropriate logic for the button that the user clicked.

private void DataGrid_ItemCommand(object source, 
    DataGridCommandEventArgs e)
{
    if (e.CommandName == "AddToCart")
    {
        // Add code here to insert details into database.
        // Use the value of e.Item.ItemIndex to find the data row
        // in the data source.
    }
}
Ramesh S 129 Posting Pro

TreeView is a server control, It should be enclosed within <form> tag. Also since you are using Master page, it will have a form tag so that you don't need to use a form tag in child pages where the master page is used.

Ramesh S 129 Posting Pro

Mark this thread as Solved if your question is answered.

Ramesh S 129 Posting Pro

Yes. you need to add the following namespace

using iTextSharp.text.html;
Ramesh S 129 Posting Pro

Post your error message so that it will help to identify the issue.

Ramesh S 129 Posting Pro

System.Timers.Timer and System.Threading.Timer cannot be used to use a time at client browser. They are intended to use in Desktop application or server side code. Also the System.Web.UI.Time does not have a Start() method.

It is sufficient that if you set the Interval property and handle the Tick event in your page. Also you need to use a ScriptManeger in order to function the Time control well.

Ramesh S 129 Posting Pro

int id = Convert.ToInt32(GetID.Text);
string CommandText = "SELECT * FROM table1 WHERE emp_bookid=id ";

IS the above code correct???

If emp_bookid is a numeric column and GetID is the name of the TextBox control

string CommandText = "SELECT * FROM table1 WHERE emp_bookid = " + GetID.Text

If a varchar or char type column,

string CommandText = "SELECT * FROM table1 WHERE emp_bookid = '" + GetID.Text + "'"
Ramesh S 129 Posting Pro

You cannot get the DataSource from GridView. You should store it in the Session or again fill it from database, sort it and then bind to the GridView again.

Ramesh S 129 Posting Pro

In which line this error was thrown? Any line is specified in the Stack Trace of the Exception?

Ramesh S 129 Posting Pro

Put a break point in the following line.

Select Case errmessage

And see the value of the variable 'errmessage'.

Ramesh S 129 Posting Pro

This error means that there should be a unique index for some field in _RegistrationXM table.

Therefore check any duplicate value is found in the XML data for that field.

Either remove unique index for that field(s) or remove duplicate data for the column(s) in the XML.

Ramesh S 129 Posting Pro

It seems that the error is not related to Select Case statement.

I have checked your code after removing 'errmessage = ' from your Select Case.. statements. It is working without throwing any error.

See this below code

Select Case errmessage
            Case "EMPLOYEE"
                pageerrorlbl.Text = "Sorry! The Employeed Number You have entered already exist. Please Contact the Web Admin if you think this is a mistake."
                Exit Sub
            Case "USER"
                pageerrorlbl.Text = "Sorry! The User Name You have entered already exist. Please Contact the Web Admin if you think this is a mistake."
                Exit Sub
            Case "EMAIL"
                pageerrorlbl.Text = "Sorry! The Email Address You have entered already exist. Please Contact the Web Admin if you think this is a mistake."
                Exit Sub
            Case "INSERT" Or "SUCCESS"
                Sqlcommand.CommandText = sqlinsert
                Sqlcommand.Connection = Sqlconnection
                Sqlcommand.ExecuteNonQuery()
                Response.Redirect("confirmreg.aspx")
                Exit Select
            Case "FAILED"
                pageerrorlbl.Text = "Sorry! Something is wrong. Please contact the administrator"
                Exit Select
            Case Else
                pageerrorlbl.Text() = "SKIPPED EVERYTHING"
                Exit Select
        End Select
Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Is this ok?

int width = 15;
        for (int i = 0; i < 5; i++)
        {
            string newString = String.Format("{0," + width + ":D}{1," + width + ":D}", i + 1, squares[i]);
            System.Console.WriteLine(newString);
        }
Ramesh S 129 Posting Pro

If your question is answered, please mark this thread as solved.

Ramesh S 129 Posting Pro

If you want to add Master Page to your existing web pages, the do the following things:

1. set the MasterPageFile property to your .master file name.
2. Remove the form tage from the child page if the master page already has the form tag.
3. Wrap controls in the child page with a Content control

<asp:Content id="myContent" runat="server" ContentPlaceholderId="MasterID">  page contents</asp:Content>

The value of ContentPlaceHolderID should be the ID of the ContentPlaceHolder control from the master page.

Also check this link: http://asptutorials.net/ASP/masterpages/

Ramesh S 129 Posting Pro

No need.

Put all your functions in one <script> and </script> tags.

Ramesh S 129 Posting Pro

First Request.QueryString["ID"]) is not stored in Session as you are storing the shopingCart to the Session before adding the ID to that object.

You code should look like

List<string> shopingCart = (List<string>)Session["shopingCart"];
if (shopingCart == null)
{
shopingCart = new List<string>();
}
shopingCart.Add(Request.QueryString["ID"]);
Session["shopingCart"] = shopingCart;
Ramesh S 129 Posting Pro

If this is the compleye code, you didn't close the <script> tag. Also just check whether you closed <form> and <body> tags.

If it is closed, it is working in my system.

Ramesh S 129 Posting Pro

Case "2"
strSQL = "UPDATE USER SET STATUS='1' WHERE password='" & txtpw.Text & "' and userid='" & txtid.Text & "'"
DA = New System.Data.Odbc.OdbcDataAdapter(strSQL, CON)

You have to use OdbcCommand.ExecuteNonQuery() to execute your UPDATE statement against your database.

See the below code

Case "2"
                    strSQL = "UPDATE USER SET STATUS='1' WHERE password='" & txtpw.Text & "' and userid='" & txtid.Text & "'"
                    Dim updCommand As New OdbcCommand(strSQL, CON)
                    updCommand.ExecuteNonQuery()
Ramesh S 129 Posting Pro

Yes. you have to use a SELECT statement with WHERE condtion before inserting the user information.

See the sample code below

'Change your database name and path
        Dim strConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\TestDB.MDB"
        Dim con As OleDbConnection = New OleDbConnection(strConnection)
        con.Open()

        'construct your where condtion 
        Dim strQuery1 As String = "SELECT EMPNO FROM FDXUSERS WHERE EmpNo = " + employeeNo
        Dim aCommand1 As OleDbCommand = New OleDbCommand(strQuery1, con)

        Dim objExist As Object = aCommand1.ExecuteScalar()

        'construct your INSERT statement here
        Dim strQuery2 As String = "INSERT INTO FDXUSERS VALUES(4, 'John', 30000, 20)"
        Dim aCommand2 As OleDbCommand = New OleDbCommand(strQuery2, con)

        If objExist Is Nothing Then
            aCommand2.ExecuteNonQuery()
        End If

        con.Close()
ctyokley commented: Works Perfectly! +1
Ramesh S 129 Posting Pro

You have put the break statement after closing the 'if' block and before the closing braces of 'for' loop.

So the' for' loop will be executed only once and the counter lCount++ will never be executed. Therefore it displays 'Unreachable code detected' error.

You should put the break statement inside the 'if' block.

I have changed your code.

protected void btnSellProduct_Click(object sender, EventArgs e)
    {
        string sPath = Server.MapPath("~/");
        string sFileName = sPath + "item.txt";
        string[] sArr;
        string[] sArr2;
        int lCount;
        int lCurrentStock;
        int lSellingStock;
   
        if (File.Exists(sFileName.Trim()))
        {
            sArr = System.IO.File.ReadAllLines(sFileName);
            for (lCount = 0; lCount <= sArr.Length - 1; lCount++)
            {
                sArr2 = sArr[lCount].Split(new string[] { "^^^^" }, StringSplitOptions.None);

                if (sArr2[0].Trim() == txtSellProdID.Text.Trim())
                {
                    lCurrentStock = Convert.ToInt32(sArr2[3]);
                    lSellingStock = Convert.ToInt32(txtQtyToSold.Text);
                    if (lSellingStock > lCurrentStock)
                        lblStatus.Text = "Could not Sell this Product.Out of Stock";
                    else
                    {
                        WriteToTransactionFile();
                        DecrementFromItemFile();
                        lblStatus.Text = "Transaction Processed Successfully";
                    }
                    break;
                }

            }
        }

    }
Ramesh S 129 Posting Pro

The index of the first column starts with 0 and last index is 'Total columns' -1. That is if your GridView has 7 columns then the last index will be 6.

Also you can hide a column in a GridView by the following method

GridView1.Columns[6].Visible = false;
Ramesh S 129 Posting Pro

You have ro check the value of the variable @sql and execute the SELECT query stored in it.

Pass necessary parameters to your stored procedure and print the @SQL variable from your query.

Put a print statement before EXEC as below

PRINT @SQL

This will print the content of @SQL in the output window in SQL Management Studio.

Copy that query, past it in a new Query Window and execute it.

Check whether it returns any result.

Ramesh S 129 Posting Pro

To use Visual Web Developer 2008 Express for Silverlight 2 development

1. You need to install Microsoft Visual Web Developer 2008 Express with SP1.

2. Install Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1. This will add C# and VB.NET Project templates for Silverlight 2.


To use Visual Studio Team System 2008 for Silverlight 2 development

1. You need to install Microsoft Visual Studio 2008 Service Pack 1

2. Install Microsoft® Silverlight™ 2 Tools for Visual Studio 2008 SP1. This will add C# and VB.NET Project templates for Silverlight 2.

Ramesh S 129 Posting Pro

You can design local reports (.rdlc) report using VS 2008 and display it in a web page using report viewer control.

Check this link: http://www.codeproject.com/KB/webforms/ReportViewer.aspx

Ramesh S 129 Posting Pro

Hi SID,

Mark this thread as solved.

Regards

Ramesh S 129 Posting Pro

Do you want to pass paramters to crystal report or SSRS?

Ramesh S 129 Posting Pro

sqlinsert = "INSERT INTO FDXUSER(First_Name,Last_Name,Email,Station_ID,User_Name,Password,SQ_1,SA_1,SQ_2,SA_2,SQ_3,SA_3,Security_Level)Values(" & first_name.Text & "," & last_name.Text & "," & email_address.Text & ",'" & Stationident.SelectedValue & "'," & User_Name.Text & "," & password1.Text & "," & "*,*,*,*,*,*,3)"

You are only putting single quote around Stationident.SelectedValue.

Is that Station_ID the only text column in the FDXUSER table?

If irst_Name,Last_Name,Email etc.. are also text columns, then put single quoto for them.

Ramesh S 129 Posting Pro

Post your code segment where you are getting issue.

It will be helpful to give you a solution.

Ramesh S 129 Posting Pro

You have put a single quote before the file name(Data Source='~\FDXDB3.mdb) which is not closed properly.

It should be like below

SqlConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source='~\FDXDB3.mdb';User ID=Admin;Password=;"
Ramesh S 129 Posting Pro

It seems that you have mixed both classic asp and asp.net to achieve your requirement.

I have given some sample code for this. Hope this will help you.

HTML Source

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

<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
    </div>
    </form>
</body>
</html>

Code behind class source

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


public partial class DemoPage5 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadControls();
    }

    private void LoadControls()
    {
        for (int i = 0; i < 10; i++)
        {
            Button btn = new Button();
            btn.ID = "buttonX" + i.ToString();
            btn.CommandArgument = "arg" + i;
            btn.CommandName = "YourCommandName";
            btn.Text = "Delete";
            btn.Command += new CommandEventHandler(ButtonX_Command);
            PlaceHolder1.Controls.Add(btn);

            LiteralControl litCtrl = new LiteralControl("<br/>");
            PlaceHolder1.Controls.Add(litCtrl);

        }
    }
    protected void ButtonX_Command(object sender, CommandEventArgs e)
    {
        string cmdArgument = e.CommandArgument.ToString();
        switch (cmdArgument)
        {
            case "arg0":
                //your code
                break;

            case "arg1":
                //your code
                break;

            case "arg2":
                //your code
                break;

        }
    }
}
Ramesh S 129 Posting Pro

Try either

window.location.reload(true);

or

window.opener.document.forms(0).submit();

before you close the popup window.

Ramesh S 129 Posting Pro

Post your code. It will help us to give you a correct solution.

Ramesh S 129 Posting Pro

Try this. buttonX.CommandName = attributeName;

Ramesh S 129 Posting Pro

You can use CommandName and CommandArgument for this requirement.

A Simple example

HTML source

<form id="form1" runat="server">

      <h3>Button CommandName Example</h3>

      Click on one of the command buttons.

      <br /><br />

      <asp:Button id="Button1"
           Text="Sort Ascending"
           CommandName="Sort"
           CommandArgument="Ascending"
           OnCommand="CommandBtn_Click" 
           runat="server"/>

      &nbsp;

      <asp:Button id="Button2"
           Text="Sort Descending"
           CommandName="Sort"
           CommandArgument="Descending"
           OnCommand="CommandBtn_Click" 
           runat="server"/>

      <br /><br />

      <asp:Button id="Button3"
           Text="Submit"
           CommandName="Submit"
           OnCommand="CommandBtn_Click" 
           runat="server"/>

      &nbsp;

      <asp:Button id="Button4"
           Text="Unknown Command Name"
           CommandName="UnknownName"
           CommandArgument="UnknownArgument"
           OnCommand="CommandBtn_Click" 
           runat="server"/>

      &nbsp;

      <asp:Button id="Button5"
           Text="Submit Unknown Command Argument"
           CommandName="Submit"
           CommandArgument="UnknownArgument"
           OnCommand="CommandBtn_Click" 
           runat="server"/>

      <br /><br />

      <asp:Label id="Message" runat="server"/>

   </form>

Class file source

void Page_Load(Object sender, EventArgs e)
      {

         // Manually register the event-handling method for the Command  
         // event of the Button controls.
         Button1.Command += new CommandEventHandler(this.CommandBtn_Click);
         Button2.Command += new CommandEventHandler(this.CommandBtn_Click);
         Button3.Command += new CommandEventHandler(this.CommandBtn_Click);
         Button4.Command += new CommandEventHandler(this.CommandBtn_Click);
         Button5.Command += new CommandEventHandler(this.CommandBtn_Click);

      }


void CommandBtn_Click(Object sender, CommandEventArgs e) 
      {

         switch(e.CommandName)
         {

            case "Sort":

               // Call the method to sort the list.
               Sort_List((String)e.CommandArgument);
               break;

            case "Submit":

               // Display a message for the Submit button being clicked.
               Message.Text = "You clicked the <b>Submit</b> button";

               // Test whether the Command Argument is an empty string ("").
               if((String)e.CommandArgument == "")
               {
                  // End the message.
                  Message.Text += ".";
               }
               else
               {
                  // Display an error message for the command argument. 
                  Message.Text += ", but the command argument is not recogized.";
               }                
               break;

            default:

               // The command name is not recognized. Display an error message.
               Message.Text = "Command name not recogized.";
               break; 

         }

      }
Ramesh S 129 Posting Pro

Use this sample code

using System;
using System.Data;

public partial class DemoCheckBoxList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Bind CheckBoxList on page load
        if (!IsPostBack)
            BindCheckBoxList();
    }

    private void BindCheckBoxList()
    {

        //You can load the following DataTable from a database
        DataTable dtBooks = new DataTable();

        dtBooks.Columns.Add("Is_Chosen", System.Type.GetType("System.Boolean"));
        dtBooks.Columns.Add("Book_Name", System.Type.GetType("System.String"));

        dtBooks.Rows.Add(new object[] { true, "ASP.NET Programming" });
        dtBooks.Rows.Add(new object[] { true, "Beginning Web Development" });
        dtBooks.Rows.Add(new object[] { false, "ASP.NET for Dummies" });
        dtBooks.Rows.Add(new object[] { true, "SharePoint 2007" });
        dtBooks.Rows.Add(new object[] { false, "PHP Programming" });

        //Binding DataTable to the CheckBoxList control
        cblBooks.DataSource = dtBooks;
        cblBooks.DataTextField = "Book_Name";
        cblBooks.DataValueField = "Is_Chosen";
        cblBooks.DataBind();

        //Select/Unselect checkboxes based on the value of 'Is_Chosen' boolean column 
        //of the DataTable
        for (int i = 0; i < dtBooks.Rows.Count; i++)
            cblBooks.Items[i].Selected = (Boolean)dtBooks.Rows[i]["Is_Chosen"];


    }
}
Ramesh S 129 Posting Pro

Just change 'If rdr.HasRows' to 'If rdr.Read()'

Therefore your code should be as follows

If rdr.Read() Then
            If ddltype.SelectedValue = "Customer" Then
                Session("ses_dname") = rdr("CusFName") + " " + rdr("CusLName")
                Session("ses_uid") = rdr("Cusid")
                Response.Redirect("Home1.aspx")
                'ElseIf 
                '   ddltype.SelectedValue = "Delivery Boy" Then
                '  Session("ses_dname") = rdr("FirstName") + " " + rdr("Lastname")
                ' Session("ses_uid") = rdr("staffid")
                'Session("ses_utype") = rdr("Designation")
                'Response.Redirect("DeliveryBoyDirection.aspx")
            Else
                ddltype.SelectedValue = "DeliveryBoy"
                Session("ses_uname") = rdr("FirstName") + " " + rdr("LastName")                Session("ses_uid") = rdr("staffid")
                Session("ses_utype") = rdr("Designation")
                Response.Redirect("DeliveryBoyDirection.aspx")

            End If
        End If
Ramesh S 129 Posting Pro

Hope this article will be helpful to you.

Refresh Web Pages After Download Completed

Ramesh S 129 Posting Pro

Post some code from the code behind class file related to this issue. It will help us to understand the problem.

When the SelectedIndexChanged event is fired, Just check whether the DataBind method for the Grid is reached by putting a break point on that.

Ramesh S 129 Posting Pro

Write the following code in RowDataBound event of the GridView control. This code is to attach onChange event of the file upload control to the click event of image button control.

imgRespuesta = e.Row.FindControl("imgProDiagUploadRespuesta")fupRespuesta = e.Row.FindControl("fupvcProDiaRutaRespuesta")

fupRespuesta.Attributes.Add("onchange", "return document.getElementById('" + imgRespuesta.ClientID + "').click();")

Write this code in RowCreated event of the GridView. This code is to set style for image button and add handler to it.

imgRespuesta = e.Row.FindControl("imgProDiagUploadRespuesta")
imgRespuesta.Attributes.Add("Style", "Display:none")
AddHandler imgRespuesta.Click, AddressOf img_Click

I have tested this way in C#. It is working for me. I can able to reach img_Click event if a file is browsed and selected.

culebrin commented: Nice approach +2
Ramesh S 129 Posting Pro

Below is the C# code to get the selected items from a CheckBoxList

for (int i=0; i<checkboxlist1.Items.Count; i++)
         {

            if (checkboxlist1.Items[i].Selected)
            {

              //Write your code to store checked items into database
            }

         }
Ramesh S 129 Posting Pro

1. Open the folder , where you placed you assembly .dll, using Windows Explorer.
2. Just right click on the assembly .dll file
3. Go to Versions Tab
4. Click on the File Version item in the Other version informtion panel to see the version details
5. Click on the Language item in the Other version informtion panel to see the version details

Mark as solved if this post answered your question

Ramesh S 129 Posting Pro

You can use the strong naming tool with the -T option to extract the public key of an assembly.

1. Open the VS command prompt

2. Type the following command

sn -T YourAssemblyName.dll