Ramesh S 129 Posting Pro

Do you mean you want to retrieve the name of a column in a DataTable?

If yes, DataTable.Columns[ColumnIndex].ColumnName return the name of the column specified by 'ColumnIndex'.

For example, to retrieve the name of the 4th column from the DataTable object 'dtEmp',

String colName = dtBooks.Columns[3].ColumnName ;

Note that the column index starts with 0.

Ramesh S 129 Posting Pro

Hi Guys,

I am searching for Open Source Finance scripts such as Account Payable, Account Receivable, General Ledget etc in PHP. But I could n't find a good one.

Is there any such open source scripts in PHP available over the web for download?

If so, could you please give me the links.

Thanks

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

Refer this link: Global Web Stats

You can also view the statistics for past period through "View archived reports" dropdownlist in that site.

Refer this link also.

Usage share of web browsers

Ramesh S 129 Posting Pro

Try this link.

How To Reorder The Row of Gridview on Button click

In the following link, Reorder has been implemented using DataGrid control. You can change it to GridView.

DataGrid Rows Reordering

Ramesh S 129 Posting Pro

You can use Page.ClientScript.RegisterStartupScript to open a popup window from ASP.NET code behind. For example

protected void LinkButton1_Click(object sender, EventArgs e)
    {

       //Write some code here


        string url = "TestPage2.aspx";
        ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", url));

    }
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

From your first post, it seems that you put the ChecBoxList control inside a Repeater control.

If so, you can try this code.

protected void Page_PreRender(object sender, EventArgs e)
    {
        foreach (RepeaterItem ritem in Repeater1.Items)
        {
            CheckBoxList chkList = ritem.FindControl("CheckBoxList1") as CheckBoxList;
            foreach (ListItem listitem in chkList.Items)
            {
                listitem.Attributes.Add("onclick", "alert('hey');");
            }
        }
    }

Anyway, you found a solution by yourself.

Mark this thread as solved/

Ramesh S 129 Posting Pro

Hi samehsenosi,

Datasource is not specified in the connection string.

Set the data source and try it again.

Ramesh S 129 Posting Pro

Putting the CheckBoxList control inside a UpdatePanel control does not make this problem.

The CheckBoxList is implemented a collection of ListItems.

Attributes added to a ListItem control don't get rendered during postback.

Actually it is a bug in ASP.NET.

Refer the following links to know more about on this bug.

http://unboxedsolutions.com/sean/archive/2004/05/04/213.aspx
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q309338
http://aspnet.4guysfromrolla.com/articles/091405-1.aspx

To work around this issue, you need to add attributes to ListItem collection in the Page PreRender event instead of DataBound event.

Try this code.

protected void Page_PreRender(object sender, EventArgs e)
    {

        foreach (ListItem listitem in chkSides.Items)
        {
            listitem.Attributes.Add("onclick", "alert('hey');");
        }
    }
Ramesh S 129 Posting Pro

AFAIK, It seems that the WebBrowser control does not work in Windows Service. Since it is a UI control, it has to be used in WinForms application.

Instead you can try to use WebRequest and WebResponse classes.

Ramesh S 129 Posting Pro

If you want to execute code such as opening a window at specified intervals, use Ajax Timer control.

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

Hi jbisono ,

I am clear about your requirement now. You may need to write code specific to the child pages in the page _load event of the master page. So that it will be executed automatically for all child pages.

You can use Page.GetType().Name or other technique like this to get the child page name in Master page and write the specifc code to it.

Alternatively you can create BasePage class and inherit all your child pages from this class.Override the OnLoad event in the BasePage and write code specific to the pages inherited from it.

Ramesh S 129 Posting Pro

Hi Stretcher,

Mark this thread as solved.

Ramesh S 129 Posting Pro

Hi Anup,

Which CMS are you going to use?

Do you already have any CMS software or looking for a open source one?

DotNetNuke is a popular open source content management system and application development framework for ASP.NET. It also has very good online community support. Look into that.

Ramesh S 129 Posting Pro

Does your page getting postback when you click the image link?

If so, set the Page.MaintainScrollPositionOnPostBack Property to true to to return the user to the same position in the client browser after postback.

Ramesh S 129 Posting Pro

Hi Stretcher,

Welcome to DaniWeb.

Use code tags to format your code.

Why do you use Request object to get the value of TextBox control. You can use like TextBox1.Text to get the value of it.

Also you are using <form> tag inside the server controls. Basically the ASP.NET controls should be surrounded by <form> tag.

To get the value of Customer_Name textbox value from Request object, try this

Request("TabContainer1$TabPanel1$Customer_Name")
Ramesh S 129 Posting Pro

I am having a small problem... I can connect to a local MySql Database using:

SQLConn.ConnectionString = "Data Source=servername;" & _
"Initial Catalog=databasename;" & _
"User ID=username;" & _
"Password=userpassword;"

Where servername is "localhost". I need to make a connection to an online database (same data structure). What should I put at the servername in that case? I do have all the info about the database in question (Domain, Ip, etc...). Which part should i use?

Hi xcorpionxting ,
The above syntax can be used to connect with SQL Server. Are you able to connect with MySQL using this syntax?

What type of object is SQLConn?

If it is System.Data.SqlClient.SqlConnection, you cannot use it to connect with MySQL database.

You need to use following providers to connect with MySQL.
MySQL Connector/Net (MySqlConnection)
.NET Framework Data Provider for OLE DB (OleDbConnection)
.NET Framework Data Provider for ODBC (OdbcConnection)
Any third party ADO.NET provider for MySQL

For connection strings on MySQL, visit this link.

Ramesh S 129 Posting Pro

The ASP.NET FormView control allows you to edit, delete, and insert records associated with a data source.

Refer the following links.
http://www.learn-asp.net/ASPTutorials/FormView.aspx
http://quickstarts.asp.net/quickstartv20/aspnet/doc/ctrlref/data/formview.aspx
http://www.beansoftware.com/ASP.NET-Tutorials/FormView-Control.aspx

Ramesh S 129 Posting Pro

Each child web forms will have different controls. If you want to access child page controls in your master page, then you can do it something like

ContentPlaceHolder1.FindControl("Button1")

Or do you want to get master page event in your child pages? if so, refer this link.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi Siddesh,

The System.Net.NetworkInformation will not be supported in Compact Framework.

You need to use OpenNETCF library to get the MAC address of a PDA.

The OpenNETCF.Net.NetworkInformation Namespace can have classes and methods to achieve this.

Ramesh S 129 Posting Pro

Refer these links.

PhysicalAddress Class
Get MAC address of client machine using C#

Also try this code snippet.

using System;
using System.Windows.Forms;
using System.Management; 
.
.
.

 private void button1_Click(object sender, EventArgs e)
        {
            ManagementObjectSearcher objQuery = null;
            ManagementObjectCollection queryCollection = null;

            try
            {
                objQuery = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration");

                queryCollection = objQuery.Get();

                foreach (ManagementObject mgmtObject in queryCollection)
                {
                    if (mgmtObject["MacAddress"] != null)
                    {
                        MessageBox.Show(mgmtObject["MacAddress"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Source);
                MessageBox.Show(ex.Message);
            } 

        }
Ramesh S 129 Posting Pro

Are you able to access the application in IE. or is this error occured only for FF?

Also do the following settings.

1. Open Control Panel –> Program –> Turn Windows Features On or Off

2. Expand Internet Information Services –> World Wide Web Services ->Application Development Features

3. Check this features: ASP.NET, ISPI, ASP, CGI(whatever you required).

If the above settings are already done ignore this.

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

It would be better if you store the forum messages in a database system. So that you can easily store, retrieve the data with better performance.

If you store the forum data in a datbase, you can use the features specific to database systems such as security, indexing, stored precedures, views.

You can use SQL Server 2005/2008 Express Editions, MySQL for this purpose. You can also even use MS-Access which has limited features comparing with SQL Server and MySQL.

If you have a plan to use open source forum software, please check which database are supported by that software.

Ramesh S 129 Posting Pro

Mark this thread as Solved if your question is answered.

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

FormView is basically used to display the values of a single record from a data source.

The controls in the ItemTemplate will be rendered only after binding a data source to the FormView control.

In the BindFormView() method, you didn't bind any data source to the FormView control. Therefore myFormView.FindControl("myLabel") returns always nothing.

Try after data binding to the FormView. It will return the Label control.

Ramesh S 129 Posting Pro

Do not call the Random.Next twice in the same statement.

Try something link this.

Dim objRandom As Random = New Random()
        Dim n1 As Int32 = objRandom.Next(1000, 999999)
        Dim n2 As Int32 = objRandom.Next(1000, 999999)
        sPrintString = sName & "_" & DateTime.Now.ToString("yyyyMMddHHmmssffffff") & "_" & n1.ToString() & "_" & n2.ToString()
        Response.Write(sPrintString)

If you still getting the same error, try the static class approach specified in this link.

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

For button field in GridView, set the CommandName property of the button to some value.
Handle the RowCommand event of GridView and check if the value of the argument 'e' (GridViewCommandEventArgs type) is equal to the value of the button's CommandName.

Ramesh S 129 Posting Pro

You can decompile a .NET assembly using .NET Reflector if it is not obfusticated.

Ramesh S 129 Posting Pro

If the variable 'imgfilepath' has a invalid path or file name, it will throw
System.IO.DirectoryNotFoundException with error message 'Could not find a part of the path .......'.

Otherwise post the complete exception message. It will help to identity the exact issue.

Ramesh S 129 Posting Pro

It might be occured due to IE browser setting.

Change browser settings as mentioned below:
--Click Tools | Internet Options
--Go to the Security tab, then click the Custom Level button.
--Under the Downloads section of the list, look for Automatic prompting for file downloads and click Enable.
--Click OK.

Ramesh S 129 Posting Pro

Hi Pankaj,

Mark this thread as solved if your question is answered.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi cavpollo,

Mark this thread as solved if your question is answered.

Ramesh S 129 Posting Pro

It can be done by setting default button property at page level.

The defaultbutton property can be specified at the Form level in the form tag

<form id="form1" runat="server" defaultbutton="button2 ">
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

Place your connection information in web.config. Assume that your database is in App_data folder of your of web site.

<connectionStrings>

<add name="TestConnectionString" connectionString="Server=.\SQLExpress;AttachDbFilename=|DataDirectory|student1.mdf;Integrated Security=True;User Instance=True"  providerName="System.Data.SqlClient"/>
    </connectionStrings>

To use the connection string from web.config

Using System.Data;
Using System.Data.SqlClient;
Using System.Configuration;
.
.
.

    SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnectionString"].ConnectionString);

    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand(
            "SELECT * FROM Customers", connection);
    DataSet dsCustomers = new DataSet();
    adapter.Fill(dsCustomers);
   connection.Close();
Ramesh S 129 Posting Pro

It means that the index '4' in the collection e.Row.Cells is outside the bounds of that collection. So it throws the error.

The first column starts with the index 0. Therefore you need to specify the index as 3 if you want to hide the 4th displayed column of the GridView.

Change your code as below

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header || e.Row.RowType == DataControlRowType.DataRow)        
        {            
            e.Row.Controls[3].Visible = false;            
        }
    }

Instead of handling RowDataBound, you can also hide a auto generated column after binding your GridView. See this code.

GridView1.DataSource = yourDataTable;
        GridView1.DataBind();
        GridView1.HeaderRow.Cells[3].Visible = false;
        foreach (GridViewRow gvr in GridView1.Rows)
        {
            gvr.Cells[3].Visible = false;
        }
Ramesh S 129 Posting Pro

Try the following tools.

ArgoUML - Java based UML modelling tool
Poseidon for UML - The community edition is free
ClassBuilder - This can be used to create class and sequence diagrams
StarUML - Open source UML tool
http://www.softdevtools.com/modules/weblinks/viewcat.php?cid=54 - Find some UML tools with many of them free in this url
Dia - you can create some basic UML diagrams.

Ramesh S 129 Posting Pro

Hi sakhi kul,

Post full VB.NET code. It will help to identify the issue.

Are you putting the above VB.NET code segment in a For loop?

Where do you fill your data set. after for loop?

Ramesh S 129 Posting Pro

Look into the Adobe Flex open source framework.

Adobe Flex is a software development kit released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. It is simply a library of components that are used to develop applications using Adobe’s flash runtime.

Refer these links for more details.

http://www.adobe.com/devnet/flex/flex_net.html
http://www.developerfusion.com/article/9536/using-adobe-flex-in-visual-studio/

Ramesh S 129 Posting Pro

I found a solution in a forum that installing Visual Studio 2008 SP1 addressed this issue.

Ramesh S 129 Posting Pro

Hi John,

Why do you want to construct the connection string dynamically in your class file?

Store the connection information in web.config file for web applications and app.config file for WinForms application. You can retrieve the conneciton information using System.Configuration.ConnectionStringSettings class in your class file.

For your question, You can use Server.MapPath in your class file using HttpContext object. Try System.Web.HttpContext.Current.Server.MapPath method.