Ramesh S 129 Posting Pro

You have used 'Data' as the DataValueField in the DropDownList.

Therefore the 'SelectCommand' property should be as below

SelectCommand="SELECT [DelName], [Data] FROM [DelBoy_Table]"

Here I assumed that the DelBoy_Table has a column by the name 'Data'

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

I have posted the tested version of the code(except last line in page load event which was missed in copy/paste).

Even if you are using place holder, then you should add dynamic controls only page load or page init events. Adding dynamic controls in child control's event like button_click will be vanished between postback.

Ramesh S 129 Posting Pro

Sorry i missed the last line in the page load event in the code in my fist post.

protected void Page_Load(object sender, EventArgs e)
    {
            Button btn = new Button();
            btn.ID = "btnTest1";
            btn.CommandArgument = "arg" + i;
            btn.CommandName = "YourCommandName";
            btn.Text = "Delete";
            btn.Click += new EventHandler(btnTest_Click);
            PlaceHolder1.Controls.Add(btn);
           //Here PlaceHolder1 is a place holder control.

}


protected void btnTest_Click(object sender, EventArgs e)
    {

    }
Ramesh S 129 Posting Pro

i am runing my program on local and the full path of the file is

C:\Documents and Settings\joe.elhajj\My Documents\Visual Studio 2005\Projects\final test\final test

i tried to put it in the connection data source but the same error occurs

Just for testing purpose,


Place your sdf file in C:\test.sdf and then change your connection details as

Dim ConnPPC As New System.Data.SqlServerCe.SqlCeConnection("Data Source=C:\test.sdf")

Now check whether it is working.

Ramesh S 129 Posting Pro

1. Install the MySql connector for which is MySQL's fully managed ADO.Net provider. You can download it from http://dev.mysql.com/downloads/connector/net/6.0.html

2. Use MySql.Data.MySqlClient namespace to connect with MySQL database from your application.

Check thse links:
http://iseesharp.blogspot.com/2006/09/connecting-mysql-and-c.html
http://bitdaddys.com/MySQL-ConnectorNet.html

Ramesh S 129 Posting Pro

This is related to asp.net question.

You cannot maximize the browser window through either server side or client code. But there is a work around solution throuh which browser will fit in the whole screen.

Put the following code on page load event of your .aspx page.

protected void Page_Load(object sender, EventArgs e)
    {

       Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "maximizeScript", "top.window.moveTo(0,0); top.window.resizeTo(screen.availWidth,screen.availHeight);", true);

    }
Ramesh S 129 Posting Pro

Where are you running your application. In local or inside a mobile device or emulator?

Inside mobile device or emulator, You can mention data source like
"Data Source =\My Documents\test.sdf". You cannot specify drive name like 'C:\' or 'D:\'.

If you are running your application in local( your PC) and your project is not smart device project, then check whether the test.sdf exists in the folder 'C:\final test'.

Ramesh S 129 Posting Pro

No. creating controls after page init or page load will lead to problems.

A good approach to handle tree node event to create dynamic control is to check the value of Request.Params["__EVENTTARGET"] in page load and then create it.

Ramesh S 129 Posting Pro

You have put meta tags between <Head> elements like below

<head>
<meta name="description" content="Free Web tutorials" />
<meta name="keywords" content="HTML,CSS,XML,JavaScript" />
<meta name="author" content="Hege Refsnes" />
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
</head>

Refer this link : http://www.w3schools.com/tags/tag_meta.asp

To programattically add to your page

// Render: <meta name="keywords" content="Some words listed here" />
HtmlMeta meta = new HtmlMeta();
meta.Name = "keywords";
meta.Content = "Some words listed here";
this.Header.Controls.Add(meta);

Refer: http://ryanfarley.com/blog/archive/2006/03/25/18992.aspx

Ramesh S 129 Posting Pro

You can create dynamic control in Page Load or Page Init events only. Otherwise they won't be retained in ViewState and vanished between postback.

If you want to create a dynamic control when tree view is expanded, then check the value of Request.Params["__EVENTTARGET"] in the page load event and create dynamic control in the page load event based on that.

The Request.Params["__EVENTTARGET"] may have your tree node information if the tree view node post back the page.

Ramesh S 129 Posting Pro

1. Create an dummy .aspx, for example TiffImage.aspx.
2. Write the following code in the Page_Load event of the TiffImage.aspx

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Imaging;
public partial class TiffImage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentType = "image/gif";
        String imageFileName = HttpRuntime.AppDomainAppPath + Request.QueryString["ImagePath"];
        new Bitmap(imageFileName).Save(Response.OutputStream, ImageFormat.Gif);
    }
}

3. Assume that you want to display test.tiff file in the DemoPage.aspx . Then your HTML part of your DemoPage.aspx

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

<!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>
        [B]<img src="TiffImage.aspx?ImagePath=test.TIF" />[/B]
    </div>
    </form>
</body>
</html>

Here the test.tif is passed as a query string to TiffImage.aspx file where the TIFF file save as GIF and rendered in DemoPage.aspx

Ramesh S 129 Posting Pro

Try this sample code.

protected void Page_Load(object sender, EventArgs e)
    {
            Button btn = new Button();
            btn.ID = "btnTest1";
            btn.CommandArgument = "arg" + i;
            btn.CommandName = "YourCommandName";
            btn.Text = "Delete";
            btn.Click += new EventHandler(btnTest_Click);
}


protected void btnTest_Click(object sender, EventArgs e)
    {

    }
Ramesh S 129 Posting Pro

Check whether you have Microsoft.Office.Interop.Excel.dll in the BIN folder of the application.

Microsoft.Office.Interop.Excel Version 11 is related to Excel 2003 and Version 12 is related to Excel 2007.

Check whether the client system have Excel 2003 installed.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

I am adding rows to a runtime table as following"

dtRecords.Rows.Add("RecordingDate", typeof(DateTime));

You can add rows to a DataTable using the following syntax

DataTable.Rows.Add(DataRow) ;
DataTable.Rows.Add(Object[] ) ;

But you are passing two arguments. Are you passing column name in you code ('RecordingDate').


How is it possible?

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

If database column bound to the database is boolean type, then the checkbox in the template column will automatically checked.

See my code snippet in this link: http://www.daniweb.com/code/snippet1248.html

In the above code snippet, i have bound a checkbox template column to a boolean field in a DataTable which is created temprorily(not retrieved from database). Change that code slightly to address you requirement.

Ramesh S 129 Posting Pro

The good solution:

SELECT *
   FROM (SELECT *
                 FROM emp
               ORDER BY sal DESC)
 WHERE ROWNUM <= 3

What anubina wrote is correct.

The syntax is

SELECT *
  FROM (SELECT * FROM table_name ORDER BY col_name DESC)
 WHERE ROWNUM <= N;

Check this link

Ramesh S 129 Posting Pro

I thought you are working smart device project. Just leave it.

Dim ConnPPC As New System.Data.SqlServerCe.SqlCeConnection("Data Source =C:\Practice\test.sdf")

Here 'Practice' is name of the folder where i keep the SDF file. It is working for me.

Did you get any error?

Ramesh S 129 Posting Pro
Dim filename As String = Path.GetFileName(filepath)
Dim filepath As String = Server.MapPath(Request("file"))
Dim file As System.IO.FileInfo = New System.IO.FileInfo(filepath)

In the above code segment, You have used the variable filepath before it is declared in the second statement. How did you compile your code without any errors?

Can you post complete code.

sknake commented: good catch! +5
Ramesh S 129 Posting Pro

This file must be in your PDA or emulator. So copy the .sdf , for example, to the My Documents folder in the PDA or emulator.

And then try this

Dim ConnPPC As New System.Data.SqlServerCe.SqlCeConnection("Data Source =" + @"\My Documents\test.sdf;")
Ramesh S 129 Posting Pro

I have doubt about the path passed to the SqlCeConnection object.

Display the value of the connection details in a message box. Check whether the file name with path displayed in the messagebox is correct.

You can dislay that information from the following code

MessageBox.Show("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\test.sdf;")
Ramesh S 129 Posting Pro

Does your code throw any error?

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
Ramesh S 129 Posting Pro

Are you using Excel COM object model to generate any Excel document in your application?

If so, then the server, where you deployed the application, should also have Excel installed.

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

If you want to do this at server side code in the Page_Load event

Do the following steps:

1. Make your <body> tag server accessible by setting runat='server' and an id.

<body  id="bodyDemoPage" runat="server">

2. And then add the following code in your Page_Load event.

protected void Page_Load(object sender, EventArgs e)
    {
                bodyDemoPage.Attributes.Add("onload", "window.open('DemoPage1.aspx')");
        }
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
<%--<asp:ImageButton ID="imgBtnNext" runat="server"
Style="vertical-align: middle;" ImageUrl="next.jpg" 
CommandArgument='<%# Eval("Next")%>' OnClick="click" CommandName="Page" />--%>
</PagerTemplate>
</asp:GridView>
</asp:Panel>

In your code, I can see only closing tag ( </asp:Panel> ) of ASP.NET Panel control.

Where is the opening tag?

Also you are always using asp classic syntax in asp.net source. This will lead to complication when debugging errors.

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

Check this link: http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx

It has step by step details to update, insert records in a GridView.

Ramesh S 129 Posting Pro

To a file upload control to a PlaceHolder control

FileUpload fu1 = new FileUpload();
        fu1.ID = "fileUpload1";
        PlaceHolder1.Controls.Add(fu1);
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

public static index operator++(index x)
{
x.count++;
return count;
}

The return type of this function is of type 'index'. But you return an integer type. This fucntion should be written as

public static index1 operator ++(index1 x)
        {
            x.count++;
            return x;
        }
Ramesh S 129 Posting Pro

Hi,

If Profile object is used, then we need to use SQL Server. Because Profile data will be stored in SQL Server. Also basically Profile object is used to web site personalization.

I would recommend Session to pass custom objects between pages.

To store an object to sesssion

Employee emp = new Employee();
emp.Ename = txtEname.Text;
emp.Empno = int.Parse(txtEmpNo.Text);
emp.Salary = double.Parse(txtSal.Text);
...
...
...
Session["Emp"] = emp;

To retrieve Employee object from Session

Employee emp = (Employee)Session["Emp"];
txtEname.Textc = emp.Ename ;
txtEmpNo.Text = emp.Empno.ToString();
txtSal.Text = emp.Salary.ToString();
Ramesh S 129 Posting Pro

Ok i changed it to

SELECT * FROM Calendar WHERE Day='27'

This seems to work but now i get another error message
"The data types text and varchar are incompatible in the equal to operator"

Comparison operators can be used on all expressions except expressions of the text, ntext, or image data types.

Also use text data type if you are going to store a large amout of text in day column. Otherwise change to varchar or nvarchar.

The above SELECT statement will work with text type column if you change as below

SELECT * FROM Calendar WHERE Day LIKE '27'
Ramesh S 129 Posting Pro

This error might also be occured due to HTML code. Post your HTML code. It will be helpful to identify the root cause of the error.

Ramesh S 129 Posting Pro
Ramy Mahrous commented: Thanks for link +8
Ramesh S 129 Posting Pro

XML Security is based on Internet Explorer's security zone settings. Your application might work in another machine due security settings of the browser in that machine.

Check these links:

http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/acf0f507-307b-4443-bab5-4ad53ff93ed5
http://msdn.microsoft.com/en-us/library/ms762300(VS.85).aspx