Ramesh S 129 Posting Pro

Hi,
I Would suggest to use Entity Framework as it has many new features over ADO.NET.

  1. In EF, objects are mapped with database tables. So you don't need to write stored procedures, queries in SQL to fetch data. You can use Linq queies against objects in C# which will retrieve data using EF.
  2. Code First feature allows you to create the domain model in the C# code and write business logic on them without creating the db design first. You can create the database based on your domain model.
  3. Since all the db related code is written in your VS projects, the same can be managed in the version control from the IDE. Whereas the stored procedure to be used in ADO.NET stored in the database.
  4. You can still use stored procedures, Views and Functions in EF if needed.
  5. EF is recommended technology used to retrived data in ASP.NET MVC Framework.
Ramesh S 129 Posting Pro

Hi,

Please refer the following link.

GridView with an AJAX rating control, DropDownLists, JavaScript to enable/disable rows - an exercise

Also 'Urgent' is not a meaningful title for a thread. Please keep the thread title brief and descriptive.

Ramesh S 129 Posting Pro

Hi,

The machine.config file can be located in the following folder in the server/PC.
drive:\<windows>\Microsoft.NET\Framework\<version>\config\machine.config

You can open it using notepad or VS 2005.

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/management/mgmtapi.aspx

Ramesh S 129 Posting Pro

Hi Kiran,

Ignore my previous post. I though you assigned the GridView.SelectedIndex to GridView.PageIndex. I didn't see detailview1.PageIndex properly.

Sorry for the inconvenience. Please follow the adatapost reply.

kvprajapati commented: Hey pal! No need to say sorry :) OP is unclear. +12
Ramesh S 129 Posting Pro

Hi,

When you run an ASP.NET application from VS 2005 (without using IIS), it runs under your account's security context. Since you may have read/write access to the folder, you are able to upload files to that folder from your application.

But When you deploy and run an ASP.NET application from IIS, It runs under ASPNET account in Windows XP and NT AUTHORITY\Network Service account in Windows 2003.

You need to provide read/write access to 'mainImage' folder to NT AUTHORITY\Network Service account, so that you can save file to that folder from your asp.net application.

Lusiphur commented: Good catch! :) +1
Ramesh S 129 Posting Pro

Decided to do it like this:

if (Request.QueryString["ID"] != null)
            {
                command.Parameters.AddWithValue("@supplier_id", Convert.ToInt32(Request.QueryString["ID"]));
            }
            else
            {
                command.Parameters.AddWithValue("@supplier_id", 2);
            }

If theres a better way let me know!

Grant

Hi Grant,

The above approach seems to be okay. But still you can reduce the number of lines in the following way.

int supplierId = (Request.QueryString["ID"] != null) ? Convert.ToInt32(Request.QueryString["ID"]) : 2;        
command.Parameters.AddWithValue("@supplier_id", Convert.ToInt32(supplierId);
Ramesh S 129 Posting Pro

Hi Grant,
Request.QueryString["ID"] is read only collection which means that you cannot set/insert a value to the collection. But you can retrieve the value from the collection if exists. Request.QueryString is internally populated by ASP.NET when you pass query strings explicitly from a page.

Ramesh S 129 Posting Pro

OpenContacts.NET is open-source library for importing contacts from popular web-mail services. Now supports: GMail, Yahoo! Mail, Live (Hotmail).

Check this link.

OpenContacts.NET

kvprajapati commented: Thanks! +8
Ramesh S 129 Posting Pro

Hi Claude2005 ,

Yes.You need to provide permission to access to a folder to ASPNET account if you are running your website in Windows XP. Also you need to provide access to the folder to Network Service account if you are running your web site in Windows Server 2003.

Ramesh S 129 Posting Pro

The ASP.NET MVC Framework is a web application framework that implements the Model-view-controller pattern. It allows software developers to build a Web application as a composition of three roles: Model, View and Controller.

Check the following links to see more details.

ASP.NET MVC Tutorials
Free ASP.NET MVC eBook Tutorial

Ramesh S 129 Posting Pro

Setting the z-index property (HTML) using CSS can address this problem. The CSS class would look something like this:

.adjustedZIndex {
    z-index: 1;
}

And the Menu should look like as below

<asp:Menu ID="Menu1" runat="server">
    <DynamicMenuStyle CssClass="adjustedZIndex" />
</asp:Menu>

The z-index has to be something higher.

Some fixes have been in the following links. Try them.

ASP.NET Menu and IE8 rendering white issue
Ie8 doesn't seem to like the ASP.Net Menu control
asp:Menu in IE8
asp:menu fix for IE8 problem available

gtyler121 commented: This answered my question +0
Ramesh S 129 Posting Pro

When you add a web page to your web site/web application, You can add a master to the web page by selecting 'Select master page' checkbox in the 'Add New Item' dialogbox. It will open a dialogbox where you can select the master page for the web page.

Refer these links also.

Creating a Site-Wide Layout Using Master Pages

ASP.NET Master Pages Overview

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

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

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

Read this article.

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

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

Your dropdownlist bound to datasource for every submit. It should not be.

You need to check IsPostBack property on load event before binding the DropDownList.

Change your code as below

Protected Sub fillDropList(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        
If Not IsPostBack Then
   DropList1.DataSource = Membership.GetAllUsers()        
   DropList1.DataBind()    
End If
End Sub
Ramesh S 129 Posting Pro

A Web Service is programmable application logic accessible via standard Web protocols. One of these Web protocols is the Simple Object Access Protocol (SOAP)

Consumers of a Web Service do not need to know anything about the platform, object model, or programming language used to implement the service; they only need to understand how to send and receive SOAP messages

Actually Web services provides the ability to exchange business logic/components among diverse systems over web.

Assume that you have a requirement of using a business logic, say for example, income tax calculation in a web application and a desktop application.

Assume that web application is developed using Java and the desktop application is developed using WinForms with C#.

In this scenario, you may need to write code for java and C# separately. It increase the efforts and time.

If you implement income tax calculation as a web service and deploy it over web, both java and C# applications can consume the same service.

The web service can be written using a development platform such as C#, Java etc.

The application which consumes a web service need not be written in the same platform. For example, if you create web service using C#, it can be consumed by other applications written using Java, PHP.

Web services are base for software deployment models such as Saas, SOA and cloud computing.

Dhaneshnm commented: Nice explanation +1
Ramesh S 129 Posting Pro

Hi jbisono,

The values of the controls will not be loaded from ViewState in PreInit event. Therefore avoid to use it.

Since it seems that you want to execute some code in master page and then some code in child pages, what you mentioned is a good idea.

jbisono commented: Smart person +1
Ramesh S 129 Posting Pro

Multivalue parameters cannot be used directly with LIKE operator in SSRS. You can do it only with workaround methods.

Try this link. Passing multiple values into parameter when using LIKE operator ( SSRS 2005)

Ramesh S 129 Posting Pro

Try this code.

.aspx code

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

<!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>
        Quantity : &nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox><br />
        Date  : &nbsp;&nbsp;&nbsp; 
        <asp:TextBox ID="txtDate" runat="server"></asp:TextBox>        
        <asp:CustomValidator ID="cvValidateDate" runat="server" ErrorMessage="Date must be entered"></asp:CustomValidator><br />
        <asp:Button ID="btnValidate" runat="server" Text="Validate" 
            onclick="btnValidate_Click" />
        
    </div>
    </form>
</body>
</html>

C# code

protected void btnValidate_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(txtQuantity.Text))
        {
            int qty = int.Parse(txtQuantity.Text);
            if (qty > 0)
            {
                if (String.IsNullOrEmpty(txtDate.Text))
                {
                    cvValidateDate.ErrorMessage = "Date must be entered";
                    cvValidateDate.IsValid = false;
                }
            }
        }
    }
minbor commented: Thanks for your help. Thats exactly what I need +3
Ramesh S 129 Posting Pro

By defult, SQL membership provider creates the database with name 'aspnetdb'. But you can use your own database to create tables related to membership provider.

Also the tables and stored procedures are prefixed with 'aspnet'. The views are prefixed with 'vw_aspnet'. Therefore chances are very remote to conflict with other tables related to your application.

Also if you want to implement authentication and role management without using membership provider, then you need to develop your own implementation which may need a lot of efforts.

Dhaneshnm commented: Nice explanation +1
Ramesh S 129 Posting Pro

Hi Anupama,

Try the following code.

.aspx code

<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"></asp:CustomValidator>
        <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound"
            OnRowCommand="GridView1_RowCommand">
            <Columns>

                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

C# Code behind

public static bool IsValidDate(string date)
    {
        try
        {

            Regex reDate = new Regex(@"\b([0-9]{1,2}[\s]?[\-/\.\–][\s]?[0-9]{1,2}[\s]?[\-/\.\–][\s]?[0-9]{2,4})\b|\b(([0-9]{1,2}[TtHhSsRrDdNn]{0,2})[\s]?[\-/\.,\–]?[\s]?([Jj][Aa][Nn][Uu]?[Aa]?[Rr]?[Yy]?|[Ff][Ee][Bb][Rr]?[Uu]?[Aa]?[Rr]?[Yy]?|[Mm][Aa][Rr][Cc]?[Hh]?|[Aa][Pp][Rr][Ii]?[Ll]?|[Mm][Aa][Yy]|[Jj][Uu][Nn][Ee]?|[Jj][Uu][Ll][Yy]?|[Aa][Uu][Gg][Uu]?[Ss]?[Tt]?|[Ss][Ee][Pp][Tt]?[Ee]?[Mm]?[Bb]?[Ee]?[Rr]?|[Oo][Cc][Tt][Oo]?[Bb]?[Ee]?[Rr]?|[Nn][Oo][Vv][Ee]?[Mm]?[Bb]?[Ee]?[Rr]?|[Dd][Ee][Cc][Ee]?[Mm]?[Bb]?[Ee]?[Rr]?)[\s]?[\-/\.,\–]?[\s]?[']?([0-9]{2,4}))\b|\b(([Jj][Aa][Nn][Uu]?[Aa]?[Rr]?[Yy]?|[Ff][Ee][Bb][Rr]?[Uu]?[Aa]?[Rr]?[Yy]?|[Mm][Aa][Rr][Cc]?[Hh]?|[Aa][Pp][Rr][Ii]?[Ll]?|[Mm][Aa][Yy]|[Jj][Uu][Nn][Ee]?|[Jj][Uu][Ll][Yy]?|[Aa][Uu][Gg][Uu]?[Ss]?[Tt]?|[Ss][Ee][Pp][Tt]?[Ee]?[Mm]?[Bb]?[Ee]?[Rr]?|[Oo][Cc][Tt][Oo]?[Bb]?[Ee]?[Rr]?|[Nn][Oo][Vv][Ee]?[Mm]?[Bb]?[Ee]?[Rr]?|[Dd][Ee][Cc][Ee]?[Mm]?[Bb]?[Ee]?[Rr]?)[\s]?[,]?[\s]?[0-9]{1,2}[TtHhSsRrDdNn]{0,2}[\s]?[,]?[\s]?[']?[0-9]{2,4})\b");
            Match mDate = reDate.Match(date);
            if (!mDate.Success)
                return false;


            System.IFormatProvider ifpformat = new System.Globalization.CultureInfo("en-GB", true);
            DateTime tempDate = Convert.ToDateTime(date, ifpformat);
            if ((tempDate.Year > 1900) && (tempDate.Year < 2100))
                return true;
            else
                return false;

        }
        catch (System.FormatException)
        {
            return false;
        }
    }
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        string strDate = (sender as TextBox).Text;
        if (!String.IsNullOrEmpty(strDate) && !IsValidDate(strDate))
        {
            CustomValidator1.ErrorMessage = "Invalid date";
            CustomValidator1.IsValid = false;
            return;
        }
    }

In future, post your ASP.NET related questions here.

Ramesh S 129 Posting Pro

You are asking about Nested Master Pages feature of ASP.NET.

Master pages can be nested, with one master page referencing another as its master.

Visit this link: Nested ASP.NET Master Pages. It explains about nested master pages in detail with sample code.

Also visit these links.
http://weblogs.asp.net/scottgu/archive/2007/07/09/vs-2008-nested-master-page-support.aspx
http://www.codeguru.com/csharp/csharp/cs_network/internetweb/article.php/c12621/
http://www.aspfree.com/c/a/ASP.NET/Creating-a-Nested-Master-Page/

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi san_crazy,

CAPTCHA stands for Completely Automated Public Turing Test to Tell Computers and Humans Apart.

It is one of the most popular technique used to prevent computer programs from sending automated requests to Web servers especially to prevent spam attacks.

Google, Hotmail, PayPal, Yahoo and a number of blog sites have employed this technique.

You can store the text in database, generate the image based on that text and compare it with user input.

Refer these links:
http://www.codeproject.com/KB/aspnet/CaptchaImage.aspx
http://www.codeproject.com/KB/custom-controls/CaptchaNET_2.aspx
http://msdn.microsoft.com/en-us/library/ms972952.aspx
http://www.codeproject.com/KB/custom-controls/CaptchaControl.aspx

You can

Ramesh S 129 Posting Pro

You have mentioned SenderClass in the @Page directive in both addentry.aspx and verify.aspx.

Remove it from verify.aspx.

Also you are redirecting from addentry.aspx(from Verify() method) to verify.aspx using Response.Redirect. Therefore the following line will throw InvalidCastException error. Use Server.Transfer to avoid that error.

I have changed your code to address the above issues.

addentry.aspx

<%@ Page Language="VB" ClassName="SenderClass" %>

<script runat="server">

    ' Readonly property for first name
    Public ReadOnly Property FName() As String
        Get
            Return FirstName.Text
        End Get
    End Property

    ' Readonly property for last name
    Public ReadOnly Property LName() As String
        Get
            Return LastName.Text
        End Get
    End Property
   
    ' Readonly property for gender
    Public ReadOnly Property GenderOption() As String
        Get
            Return Gender.Text
        End Get
    End Property

    ' Readonly property for age
    Public ReadOnly Property AgeOption() As String
        Get
            Return Age.Text
        End Get
    End Property
 
    ' Readonly property for e-mail
    Public ReadOnly Property EmailOption() As String
        Get
            Return Email.Text
        End Get
    End Property
    
    'Event to transfer page control to Verify.aspx
    Sub Page_Transfer(ByVal sender As Object, ByVal e As EventArgs)
        Server.Transfer("Verify.aspx")
    End Sub
    </script>
    
<%@ Import Namespace="System.IO" %>
<html>

<script runat="server">
    
    Sub Verify(ByVal Sender As Object, _
      ByVal B As EventArgs)
        Dim GBPeople As String
        GBPeople = _
            "gbpeople.txt"
        My.Computer.FileSystem.WriteAllText(GBPeople, _
           FirstName.Text & "<br>", True)
        My.Computer.FileSystem.WriteAllText(GBPeople, _
           LastName.Text & "<br>", True)
        My.Computer.FileSystem.WriteAllText(GBPeople, _
           Gender.SelectedItem.Text & "<br>", True)
        My.Computer.FileSystem.WriteAllText(GBPeople, _
           Email.Text & "<br><br>", True)
        
        'Response.Redirect("Verify.aspx")
        Server.Transfer("Verify.aspx")
    End Sub
    </script>
    <head><title></title></head>
<body>
<h1> Sign Our Guestbook</h1>
<form id="Form1" runat="server">
First Name: <br />
<asp:TextBox id="FirstName" runat="server" /><br />
Last …
twilitegxa commented: Exactly what I needed! +2
Ramesh S 129 Posting Pro

I have changed your code to store and retrieve the values from Session.

<!-- UserForm.aspx -->
<%@ Page Language="VB" ClassName="SenderClass" %>

<script runat="server">
	' Readonly property for name
	Public ReadOnly Property Name() As String
		Get
			Return USerName.Text
		End Get
	End Property

	'Readonly Property for phone
	Public ReadOnly Property Phone() As String
		Get
			Return UserPhone.Text
		End Get
	End Property

	'Event to transfer page control to Result.aspx
	Sub Page_Transfer(sender As Object, e As EventArgs)
		Server.Transfer("Result.aspx")
    End Sub
    
    
   Sub Page_load(ByVal obj As Object, ByVal e As EventArgs)
        
        If Not IsPostBack Then
            UserName.Text = Session("Name")
            UserPhone.Text = Session("Phone")
        End If
        
    End Sub

</script>

<html>
<head>
</head>
<body>
	<form id="Form1" runat="server">
		User Name: 
		<asp:TextBox ID="UserName" runat="server" />
		Phone: 
		<asp:TextBox ID="UserPhone" runat="server" /><br>
		<asp:Button ID="Button1" Text="Submit" OnClick="Page_Transfer"
			runat="server" />
	</form>
</body>
</html>
<!-- Result.aspx -->
<%@ Page Language="VB" %>
<%@ Reference Page="UserForm.aspx" %>

<script runat="server">
    Dim result As SenderClass

	Sub Page_load(obj as Object, e as EventArgs)
		Dim content As String

		If Not IsPostBack Then
			result = CType(Context.Handler, SenderClass)
			content = "Name: " + result.Name + "<br>" _
				+ "Phone: " + result.Phone
            Label1.Text = content
            
            Session("Name") = result.Name
            Session("Phone") = result.Phone
            
            
       End If
    End Sub
    Sub Cancel_Click(ByVal sender As Object, ByVal e As EventArgs)
        Server.Transfer("UserForm.aspx")
    End Sub

</script>
<html>
<head>
</head>
<body>
<h1>Summary:</h1>
	<i><form id="Form1" runat="server">
		<asp:Label id="Label1" runat="server" /></i><br /><br />
    <asp:Button ID="Confirm" runat="server" Text="Confirm" 
            PostBackUrl="default.aspx" />
		&nbsp;
    <asp:Button ID="Cancel" runat="server" Text="Cancel" OnClick="Cancel_Click"/></form>
</body>
</html>
twilitegxa commented: Exactly what I needed! +2
Ramesh S 129 Posting Pro

The automatic sorting feature will work only if you bind the GridView with DataSource controls like SqlDataSource and ObjectDataSource. These controls automatically take care binding data with GridView. Therefore the sorting feature also handled automatically by them.

If you bind the GridView with a DataSet , then you need to call DataBind() explicitly method to bind the data source . Therefore you need to write the code to provide sorting feature.

Ramesh S 129 Posting Pro

Use ValidationGroup property.

The ASP.NET controls have a ValidationGroup property that, when set, validates only the validation controls within the specified group when the control triggers a post back to the server.

sknake commented: I always figured there was a better way. Now i know :) +17
Ramesh S 129 Posting Pro

You can use a RegularExpression validation for this purpose.

<asp:TextBox ID="TextBox1" runat="server"  />
<asp:RegularExpressionValidator ID="regExTextBox1" runat="server" 
   ControlToValidate="TextBox1"
   ErrorMessage="Minimum password length is 10"
   ValidationExpression=".{10}.*" />
sknake commented: or that +15
Ramesh S 129 Posting Pro

If the curreny data is a bound column in the GridView, then use the DataFormatString property to format data.

serkan sendur commented: good +8
Ramesh S 129 Posting Pro

Hi Alexpap ,

Post the complete error message. Becuase the error message that you posted is generic for SMO object.

Also Check the following things:

1. Database connection is estabilished before executing 'Create' method for StoredProcedure object by putting a break point.
2. sp.TextBody has correct syntax.

Ramesh S 129 Posting Pro

It is called CaptchaImage. Have a look into this article: http://www.codeproject.com/KB/aspnet/CaptchaImage.aspx

kvprajapati commented: Nice link +12
Ramesh S 129 Posting Pro

You can download a sample code from the following link which helps you store binary data into MS Access Database.

http://programming.top54u.com/post/Store-and-Display-Images-from-MS-Access-Database-Using-C-Sharp.aspx

The data type of the column to store binary data in MS Access should be OLE Object.

sknake commented: very helpful +9
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 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
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

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
Ramy Mahrous commented: Thanks for link +8
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

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

Hi,

Thanks.

From my next post onwards, I will follow that.

kvprajapati commented: Good wishes. +4
Ramesh S 129 Posting Pro

You can get this information from Installer.Context Property.

Check this link:
http://live.mscommunity.net/blogs/notequ/archive/2008/06/05/installer-class.aspx

serkan sendur commented: good information +4