Ramesh S 129 Posting Pro

When you run your application in VS 2008, it will run under your nt login credentials.

But when you deploy your application in IIS 5.x in Windows XP, it will run under aspnet account and Network Service account in Windows 2003.

Therefore the above accounts may not have access to the folder where your file exists. Just checkt that.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

The default features of asp.net server controls does not provide the functionalities which you speficied in your question.

you need to put a lot of efforts to achieve what you want.

Instead, you can look into the following third party components.

Infragistics
Telerik
ComponentArt

Ramesh S 129 Posting Pro

Use Session.Abandon() method in the logout button. Once the Abandon method is called, the current session is no longer valid and a new session can be started.

If you do not want to other users access the pages without login to system, you need to check the whether the user login details are stored in the Session in page load event of every page. For that, declare a base Page class and inherit all your pages from that base page except login page. In load event of the base Page class check if log-in details are stored in the session. If yes, allow to view the page otherwise redirect to login page.

You can also use Forms Authentication.

FormsAuthentication.SignOut Method will logout the current session and redirects to login page.

Ramesh S 129 Posting Pro

Try this.

DateTime startDate = new DateTime( 2004 , 3 , 18 ) ;
                  DateTime endDate   = new DateTime( 2004 , 3 , 22 ) ;

                  int countDays = 0;

                  DateTime dateIterator = startDate ;

                  while( dateIterator < endDate.AddDays(1) )
                  {
                        if( dateIterator.DayOfWeek != DayOfWeek.Saturday && dateIterator.DayOfWeek != DayOfWeek.Sunday )
                              countDays ++;

                        dateIterator = dateIterator.AddDays(1);
                  }

                  Console.Out.WriteLine( "Number of working days between {0} and {1}\nis {2} days" , startDate , endDate , countDays );
                  Console.Out.WriteLine( "Press Return To Finish" );
                  Console.In.Read();

Here change the start date and end dates accordingly.

Ramesh S 129 Posting Pro

1. Open VS 2008.
2. Click Help->About Microsoft Visual Studio menu

You will see something similar to

Microsoft Visual Studio 2008 Version 9.0.xxxx SP.

Also you can see service pack details under the 'Installed Products' panel in the same dialog box.

You can silverlight tools from the following link
Microsoft® Silverlight™ 3 Tools for Visual Studio 2008 SP1

Before installing this tools, make sure that atleast 5 GB free space available in the hard disk drive where your Windows OS installed.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

1. Check whether you have selected ASP.NET 2.0 Framework for your web site at IIS.
2. Also browse the site from IIS to check if its working.
3. If still get error, watch the error message displayed in the Event viewer. Post the error message here. It will help to identify the error and provide you a solution.

Ramesh S 129 Posting Pro

If You have used ASP.NET Ajax Framework 1.0 and the site is ASP.NET 2.0 based , then you need to install Ajax Framework in the server(in addition to .Net 2.0). Becuase the Ajax DLL has to be registed in GAC.

If your project is asp.net 3.5 based, then you should ensure that the right framework is installed in the server. Installing .NET 3.5 will also install Ajax framework in the server.

Apart from this, deployment is common for web site with or without Ajax.
You need to publish your site and deploy it in the server.

Refer this link.
Deploying Your Website Using Visual Studio

Ramesh S 129 Posting Pro

You can declare like this.

Partial Class YourPage
    Inherits System.Web.UI.Page

    Dim txtbox1 As TextBox
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        txtbox1 = Wizard.ContentTemplateContainer.FindControl("textbox1")
    End Sub


    Private Sub YourMethod()
        Dim str1 As String
        str1 = txtbox1.Text


    End Sub
End Class

The variable is declared at page class level. The reference of the textbox1 control is stored in page load event. It is accessed in YourMethod(). Like that you can access the variable txtbox1 in all methods in the page class.

jtok commented: Awesome post! Well put, easy to understand. Thanks! +2
Ramesh S 129 Posting Pro

Do you want to resize the columns of a GridView?

ASP.NET GridView does not allow you to resize the columns by default. You need to extend the functionality programatically.


Take a look at the following links

ASP.NET GridView column resizing
Creating a GridView with Resizable Column Headers

Ramesh S 129 Posting Pro

Hi Raman,

Which database do you want to delete duplicate records?

I may need to write an article for each database.

For SQL Server, you ca find solutions in the following links.

How to remove duplicate rows from a table in SQL Server
How to Identify and Delete Duplicate SQL Server Records
How to Delete SQL Server Database Duplicate Rows from a Table Using a Specified Column List and No Temp Tables
How to delete duplicate records in sqlserver

Ramesh S 129 Posting Pro

Hi Deepa,

Find some sample projects here.

Starter Kits and Community Projects
MSDN Code Gallery

Ramesh S 129 Posting Pro

You can try like this.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            e.Row.Cells[2].Font.Bold = true;    
        }

    }
Ramesh S 129 Posting Pro

Hi

Mark this thread as solved if your question is answered.

Regards
Ramesh. S

Ramesh S 129 Posting Pro

FreeTextBox is a good one.

Ramesh S 129 Posting Pro

ASP.NET TextBox control has a built-in Tooltip property which displays the tooltip text when the mouse is over the control.

If you want to implement a custom tooltip, refer this link.
TextBox With Tool Tip Control Implementation

You can also try to use BoxOver. It is open source tooll that uses javascript / DHTML to show tooltips on a website.

Ramesh S 129 Posting Pro

Pass the value as a query string from asp.net to php.

Also refer this link: Tips to Make ASP.NET Talk to ASP, PHP, RAILS and JAVA (Part 1)

Ramesh S 129 Posting Pro

Hi MxDev,

Do you want to highlight mutiple strings in a TextBox controls or you want to highlight strings in multiple textboxes?

You can't highlight multiple strings in a TextBox control. RichTextBox control will also not support multiple strings. But you can try your own implementation using RichTextBox.SelectionBackColor property.

If you want to highlight strings in multiple textboxes, you can use HideSelection property as adatapost said.

Ramesh S 129 Posting Pro

You need to use DataTable.NewRow to create new DataRow object with the same schema as the DataTable.

Try this.

Protected Sub gridview1_databound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.DataBound
        Dim datatable As New Data.DataTable
        datatable = CType(GridView1.DataSource, Data.DataTable)
        If Not datatable Is Nothing Then
            Dim dataRow As Data.DataRow
            'dataRow = CType(GridView1.DataSource, Data.DataRow)
            dataRow  = datatable.NewRow()
            'dataRow.Item("serial no") = 0
            'dataRow.Item("description") = 0
            'dataRow.Item("making") = 0
            'dataRow.Item("equipment no") = 0
            'dataRow.Item("quantity") = 0
            'dataRow.Item("total packets") = 0
             datatable.Rows.Add(dataRow) 
         End If
         GridView1.DataSourceID = SqlDataSource1.ID
        GridView1.DataBind()
    End Sub
Ramesh S 129 Posting Pro

Hi vuyiswamb,

Check the account under which the SQL Server instance is running.

SQL Server instance is generally running under Local System/Local Servce/Network Service accounts which may not have access rights to the UNC path.

Change that account to a domain user account which should have access to the UNC path, restart the service, and try now. Hope this will help you.

Refer these links also.
http://support.microsoft.com/?kbid=555128
http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/965cd9c4-f4d5-4492-a202-f09b78d89ed1/

Ramesh S 129 Posting Pro

Which template?

Do you want to display it in template column in a GridView/DataList/Repeater or in a ContentTemplate?

Please provide more information in detail. It will help you to get a answer from someone soon.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

If you need to add empty rows to a GridView which is bound to SqlDataSource, you can do it via the stored procedure.

Assign a stored procedure to the SelectCommand property of the SqlDataSource.

In the stored procedure, check whether record exists in the relevant database table.

If not exists return some dummy values otherwise return the records from that table.

See this sample code.

IF NOT EXISTS(SELECT 1 FROM Employee)
 BEGIN
	SELECT -1 EMPNO, ' ' Ename, 0 AS SAL 
  END
ELSE
  BEGIN
    SELECT EMPNO, Ename, SAL FROM Employee
  END
Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Do you mean ASP.NET Panel control or UpdatePanel?

If ASP.NET Panel, it is rendered as DIV at run time. Apart from that there won't be any issues when displaying a CheckBoxList inside a Panel or without Panel.

Check this code.

.aspx code

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

<!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>
        <table width="100%">
            <tr>
                <td>
                    <asp:Panel ID="Panel1" runat="server">
                        <asp:CheckBoxList ID="cblBooks" runat="server">
                        </asp:CheckBoxList>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

C# Code

using System;
using System.Data;

public partial class DemoPage38 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCheckBoxList();
        }
    }
    private void BindCheckBoxList()
    {

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

        dtBooks.Columns.Add("Book_Id", System.Type.GetType("System.Int32"));
        dtBooks.Columns.Add("Book_Name", System.Type.GetType("System.String"));

        dtBooks.Rows.Add(new object[] { 100, "ASP.NET Programming" });
        dtBooks.Rows.Add(new object[] { 101, "Beginning Web Development" });
        dtBooks.Rows.Add(new object[] { 102, "ASP.NET for Dummies" });
        dtBooks.Rows.Add(new object[] { 103, "SharePoint 2007" });
        dtBooks.Rows.Add(new object[] { 104, "PHP Programming" });

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

    }
}
Ramesh S 129 Posting Pro

A simple way is to add empty rows to the DataTable before binding to the GridView.

Ramesh S 129 Posting Pro

Check whether the data source (such as DataTable, DataSet) bound to the GridView has records by putting a break point.

If DataTable has no records, then the GridView does not render anything.

Ramesh S 129 Posting Pro

ArcGIS is a suite consisting of a group of geographic information system (GIS) software products produced by Environmental Systems Research Institute (ESRI).

ArcGIS provides the foundation for Microsoft .NET developers to rapidly build GIS applications for desktop, mobile, and Web and access GIS Web services on the Microsoft .NET platform.

Try this link.

ArcGIS for .NET Developers

Ramesh S 129 Posting Pro

There are some free javascript plugins available over web.

Try jQuery Lightbox Plugin .

Take a look at the demo site http://www.balupton.com/sandbox/jquery_lightbox/

Ramesh S 129 Posting Pro

Try this.

using System;
using System.Drawing;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace MySqlDemo
{
	/// <summary>
	/// Description of Form1.
	/// </summary>
           public class Form1 : System.Windows.Forms.Form
            {
		
                void btnCreateDB(object sender, System.EventArgs e)
                {
                  MySqlConnection conn = new MySqlConnection("Data Source=localhost;Persist Security Info=yes;UserId=root; PWD=YourPassword;");
                  MySqlCommand cmd = new MySqlCommand("CREATE DATABASE YourDBName;", conn );
		
                  conn .Open();			
                  cmd .ExecuteNonQuery();
                  conn .Close();
               }		
         }
}

You need to download MySQL Connector/Net to use the MySql.Data.MySqlClient namespace.

Ramesh S 129 Posting Pro

Hi Rick Pace,

Please mark this thread solved if your question is answered.

Regards
Ramesh S

Ramesh S 129 Posting Pro

Mark this thread Solved if your question is answered.

Ramesh S 129 Posting Pro

Read this article.

Ramesh S 129 Posting Pro

Visit this link-> Hit Counter for ASP.NET

Ramesh S 129 Posting Pro

I assume that you had created a WinForms application using VB.NET.

ASP.NET is a platform for developing web sites using .NET.

WinForms and ASP.NET differs in many things such as Architecture, Object model, Deployment etc.

HTML page is basically used to display static information to the end users over web.

If your application capture inputs from users, validates and stores them into storage medium such database, XML, you need to go for ASP.NET.

Hence you need to learn ASP.NET and start from beginning to convert your VB.NET application into ASP.NET web site.

ASP.NET web sites can be developed using C# or VB.NET. Therefore you can leverage your VB.NET skills to devlop an ASP.NET site.

Ramesh S 129 Posting Pro

In PHP, the equivalent would be-

$class->$member = "Blah, blah";

I can't figure out how this would be done in C#.

Hi Ishbir,

.NET have this feature. It is called Reflection in .NET.

You can use reflection to dynamically create an instance of a type(class), bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties.

Refer this link and also the link given by adatapost.

kvprajapati commented: very good suggestion. +6
sknake commented: reflection is my recommended approach +6
Ramesh S 129 Posting Pro

Try this.

ReportDocument cryRpt = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables CrTables ;

            cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");

            crConnectionInfo.ServerName = "YOUR SERVER NAME";
            crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
            crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
            crConnectionInfo.Password = "YOUR DATABASE PASSWORD";

            CrTables = cryRpt.Database.Tables ;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();

Reference: C# Crystal Reports Dynamic Logon parameters

Also refer this link.

How to pass Database logon info to a Crystal Report at runtime in VB .NET or in C#

bill_kearns commented: Thank you! +0
Ramesh S 129 Posting Pro

Hi Moody,

Post WinForms related questions here in future.

Hope these links will help you.

Passing Data between Windows Forms - C# Corner
Passing Data Between Forms - CodeProject
C# Information Between WinForms

Ramesh S 129 Posting Pro

Try like this.

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlDataSource1.SelectCommand = "SELECT customerID, lname, fname, dateNow FROM dbo.customers ORDER BY lname ASC";
        }
    }
    protected void SqlDataSource1_Init(object sender, EventArgs e)
    {

        SqlDataSource1.SelectCommand = String.Empty;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        SqlDataSource1.SelectCommand = "SELECT customerID, lname, fname, dateNow FROM dbo.customers WHERE rep is null ORDER BY lname ASC";

    }
Ramesh S 129 Posting Pro

You need to to get the Request.UrlReferrer if(!IsPostBack) in the Page_Load event and store it in the viewstate if your page perform postbacks.

Sometimes the Request.UrlReferrer is null if you are using AJAX to call Response.Redirect.

The UrlReferrer is based on the value of HTTP_REFERER header that a browser should send. Sometimes internet anti virus programs such as Norton's Internet Security will strip the header. Therefore the Request.UrlReferrer will be empty.

Instead of believing the Request.UrlReferrer, send the current page name as query string to the other page. In the target page, store the value of the query string in ViewState.

Refer these links.
http://stackoverflow.com/questions/149130/request-urlreferrer-null
http://stackoverflow.com/questions/1258324/should-request-urlreferrer-be-null-in-pageload-when-the-page-came-from-another-s
http://forums.asp.net/t/1101617.aspx

Ramesh S 129 Posting Pro

Hi to all,

I am using dataset to retrieve value from dataset but I can't do it, control automatically goes to next sentence without retrieving any value..

Dim scd As Integer = ds.Tables("collage_detail").Rows(x)("sc")
                                    Dim cd As Integer = ds.Tables("collage_detail").Rows(x)("c_id")

collage_detail is my table name .

How do you say the value is not retrieved?

Does it throw any error?

Have you checked the value of the variable after the control goes to next line by putting a breakpoint?

Ramesh S 129 Posting Pro

Try this.

Session.Abandon();
Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
Ramesh S 129 Posting Pro

Can you please post your connection string?

SQL Server standard edition does not support 'User Instance' clause in the connection string which is only supported in SQL Server Express Edition.

Also do not attach *.mdffile to SQL Server database each time when your code is to connected.

Refer this link.

Ramesh S 129 Posting Pro

The values for date_of_visit and floor columns are specified in wrong order in the VALUES clause. Also value is not specified for time_out column.

Ramesh S 129 Posting Pro

Hello guys
I have datagridview with each record containing a checkbox.

I need to loop through the grid rows and get checkboxes that is being checked and also row numbers.

There is also a delete button outside gridview.The above process should got executed on delete button click.

Please provide some source code.

Try this code.

protected void btnDelete_Click(object sender, EventArgs e)
    {
 
        foreach (GridViewRow grow in GridView1.Rows)
        {
            CheckBox chkStat = grow.FindControl("chkStatus") as CheckBox;
            int index = grow.RowIndex;

            if (chkStat.Checked)
            {
                //Write some code if checkbox is checked
            }
            else
            {
                //Write some code if checkbox is not checked
            }
        }
    }
Ramesh S 129 Posting Pro

You cannot assigne multiple data sources such as DataTables, SqlDataSources to the bound columns in a GridView. The data source should come from a single object.

If your want to retrieve records from different database tables which reside in different servers, you need to write some logic to fetach data from different database servers/tables, store it in temprory tables and combine them into single DataTable and assigne them to GridView.

Ramesh S 129 Posting Pro

Try this code.

using System;

public class Calculator
{
public static void Main()
{
int num1;
int num2;
string operand;
float answer;


Console.Write("Please enter the first integer: ");
num1 = Convert.ToInt32(Console.ReadLine());


Console.Write("Please enter an operand (+, -, /, *): ");
operand = Console.ReadLine();


Console.Write("Please enter the second integer: ");
num2 = Convert.ToInt32(Console.ReadLine());

switch (operand)
{
case "-":
answer = num1 - num2;
break;
case "+":
answer = num1 + num2;
break;
case "/":
answer = num1 / num2;
break;
case "*":
answer = num1 * num2;
break;
default:
answer = 0;
break;
}

Console.WriteLine(num1.ToString() + " " + operand + " " + num2.ToString() + " = " + answer.ToString());

Console.ReadLine();

}
}

Reference: http://www.devpapers.com/article/288

Also refer this link: Console calculator Part 1

Ramesh S 129 Posting Pro

Hi Akil,

Read this article. Windows Mobile: Communicating with the Outside World

Also refer this link to deploy and test this application using emultor.

Ramesh S 129 Posting Pro

You can split a string into array of sub strings based on delimiter character such as space, comma.

string str = TextBox1.Text.Trim();
        string[] temp = str.Split(' '); 
        for (int j = 0; j < temp.Length; j++)
        {
                Response.Write("  This is index " + j.ToString());
                Response.Write("  This is the string : " + temp[j]);
            }

        }