Ramesh S 129 Posting Pro

Hi,
Please provide more details about your requirements/issues in asp.net mvc.

Also refer the following links if helpful.

Treatment of spaces-only input in ASP.NET MVC

http://stackoverflow.com/questions/4282572/asp-net-mvc-razor-extra-space

Ramesh S 129 Posting Pro

Hi,
Put a breakpoint and step into the class in Visual Studio and try to find which line throws the error. Also check the field names enclosed in double quotes between lines 16 and 22 in your code.

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,

If you just want to show different light color based on the information logged into database by the device, you can just try to use <img> html tag with images for each color. Try the following steps:

  1. Display an image in <img> tag in an asp.net page. Have images for each color based on the device information.

  2. Since the information is continously updated in the database by the device, Write a method to get the latest information via web service in asp.net.

  3. Use an Ajax timer and call the web services from client script (JavaScript) in the AJAX-enabled ASP.NET Web page. Update the image link in the <Img> tag using javascript based on the informatin received from the webservice .

Check the following links to know more about calling web services from javascript asynchronously using asp.net ajax.

http://www.asp.net/ajax/documentation/live/Overview/AsynchronousLayerOverview.aspx
http://msdn.microsoft.com/en-US/library/bb515101.aspx

http://www.aspsnippets.com/Articles/Make-AJAX-Call-to-ASP.Net-Server-Side-Web-service-method-using-jQuery.aspx

If you want to dislay a more dynamic chart graph, you can try to use ASP.NET chart control. Refer the following links.

http://www.microsoft.com/en-us/download/details.aspx?id=22000
http://archive.msdn.microsoft.com/mschart

Ramesh S 129 Posting Pro

The error could be occured in the following line.

Dim gender As Integer = Convert.ToInt32(e.Row.Cells(5).Text*)

Put a breakpoint and see if the value of e.Row.Cells(5).Text is a number or empty string. It seems the index of the data cells(GridView column) may not be 5 or returns a non numeric value for some rows.

Ramesh S 129 Posting Pro

Hi,

Does this error occur in IIS or Visual Studio? If IIS, which version are you using? or are you opening a web site from IIS in Visual Studio? Please provide more details.

This will happen if you run the web application from IIS and the application pool is set to 2.0 but attribute of targetFramework is set to 4.0 in web.config. In this case, you need to change the application pool to Framework 4.0.

Ramesh S 129 Posting Pro

Hi,

Check if the web.config file has references to both 10.0.0.0 and 9.0.0.0 versions of ReportViewer control. If it contains, remove the unwanted version details and try again.

Create a new website/web application, add reference to the appropriate version of ReportViewer control and take a look at the entries that are created in the web.config. Update the same in the web.config of your existing web application.

Ramesh S 129 Posting Pro

Hi,

You can try to use GridView to display records in tabular format and on clicking a link in the GridView, Use a FormView to display the details of the row clicked.

Please look at the following links.

GridView-FormView (Master/Detail) Control
Working with the GridView and FormView

Ramesh S 129 Posting Pro

Hi,

Set the defaultbutton property in the <form> tag to the ID of button that should get fired when user press enter key to submit the form.

For example,

<form id="form1" runat="server" defaultbutton="btnLogin">
Ramesh S 129 Posting Pro

Hi,

Hope the solution given in the following link will help you.

AsyncFileUpload postback causes double upload

Someone has reported the same issue in CodePlex site here. But it is closed as the issue cannot be reproduced.

Ramesh S 129 Posting Pro

Hi,

If you are using third party components such as CuteChat they will offer the API to maintain and display the list of users entered the chat room.

If you build your own chat application, you need to maintain the user list in Session or Database or XML file.

Check the following link.

ASP.NET Ajax Chat Application

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,

Declare the Connection object myConn before the try clause and initialize it within the try.

I suggest to change your code as follows:

protected void Names()
    {

        OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\\project\\Db.mdb");
        OleDbDataReader myReader = null;
        string strQuery = "SELECT TOP 1 Name FROM Names";
        try
        {

            myConn.Open();
            OleDbCommand myComm = new OleDbCommand(strQuery, myConn);
            myReader = myComm.ExecuteReader();
            if (myReader.HasRows)
            {
                myReader.Read();
                Session.Add("Name", myReader[0].ToString());
                myReader.Close();

                //reuse the myConn connection
                strQuery = "SELECT bla bla bla WHERE bla bla bla";
                OleDbCommand myComm2 = new OleDbCommand(strQuery, myConn);
                myReader = myComm2.ExecuteReader();
            }
        }
        catch (Exception er)
        {
            Response.Write("Error:" + er.Message);
        }
        finally
        {
            if (myReader != null)
            {

                myReader.Dispose();
            }

            if (myConn != null)
            {
                myConn.Close();
                myConn.Dispose();
            }
        }
    }
Ramesh S 129 Posting Pro

Hi,

1. On page load, Fill a DataTable with records retrieved from Database.
2. Store the DataTable in Session. Also bind the DataTable to the GridView.
3. In the Edit/Update events, Get the DatatTable from Session, Update/Edit the appropriate record in the DataTable, Store it in Session again, Re-bind the DataTable to GridView.

You can finally update the DataTable with database. After saving, clear the session variable which is used for storing it.

It is not advisable to store a large DataTable in Session.

Ramesh S 129 Posting Pro

Hi,

Perform the following steps and try again.

1. Login to the system using local administrator account.

2. Add your site to the 'Trusted sites' list. IE->Tools menu->Internet Options->Security tab.

3. Enable UAC at the default level.

4. Reboot if required.

Ramesh S 129 Posting Pro

Hi,

I don't think that the issue occurs due to the server setup and hosting. Because you are saying that the chain commission calculation is skipped only for few cases.

The code may not be handling all the scenarios to perform the calculation.

Where do you handle the calculation? In the server side (C#) or database side through stored procedure?

If the logic is written in C#, It would be better to handle the calculation in the stored procedure.

Also ensure that exception handling is done well and error message are logged/displayed properly in the code.

You can try to log some messages into a text file/database table in each stage of calculation so that you could identify whether which portion of code is not reached.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi,

You are creating the <tr> within the for loop. Thus it creating multiple table rows.

Try to put it before the for loops.

Ramesh S 129 Posting Pro

Hi,

No web.config is found in the sample project downloaded from the above link.

You need to add a web.config and add connection string as below:

<connectionStrings>
   <add name="NorthwindConnectionString" connectionString="Data Source=serverName;Initial Catalog=Northwind;User ID=userName;Password=password" providerName="System.Data.SqlClient"/>
</connectionStrings>

You need to specify the correct server name, database, user id and password etc in the connection string.

Ramesh S 129 Posting Pro

Hi,

qTip is an advanced tooltip plugin using jQuery.

You can also try the following:
ASP.Net AJAX TooltipExtender
jQuery Ajax Tooltip

Ramesh S 129 Posting Pro

Hi,

You can try to use SqlBulkCopy Class in .NET.

SqlBulkCopy.WriteToServer Method (DataTable)

The above method copies all rows in the supplied DataTable to a destination table specified by the DestinationTableName property of the SqlBulkCopy object.

Also refer the following links.

Transferring Data Using SqlBulkCopy Class
Bulk Insert into SQL from C# App

Ramesh S 129 Posting Pro

Hi,

You can try to use the target="" attribute on the <form /> tag to post data to the IFRAME as follows:

<form id="Form1" runat="server"  method="post" target="iframe1">
...
...
...
<iframe  name="iframe1"  style="width: 744px; height: 333px; margin-top: 16px; margin-bottom:0px;" >

Also please refer the discussion in the following threads:

How do you post to an Iframe?
JavaScript post request like a form submit

Ramesh S 129 Posting Pro

Hi,

What do you mean by msgbox control?. There is no msgbox control in asp.net. There is aMessageBox class available in C# which displays a message box that can only be used with Windows Forms applications. It cannot be used with web application.

Please provide more details.

Also if the redirected page reads the content of the text file which is created by the C# exe, you should redirect to that page only after the text file is created by the exe ie., after the execution of the exe is completed. For this, you can useSystem.Diagnostics.Process class to run the c# exe and redirect to the aspx page in the Process.Exited event which occurs when a process exited/completed.

Ramesh S 129 Posting Pro

Hi,

Removing the space in the URL works for me in IE7 but not in Firefox 4.0.

You are using the name of the IFRAME in the getElementById() function. You need to use the ID of the IFRAME instead of name. Hence changing the following statement works for me in both IE7 and Firefox4.0.

function loadIframe() {
document.getElementById("iframecredit").src = "https://www.vcs.co.za/vvonline/ccform.asp";
return false;
}

Here 'iframecredit' is given as ID of the IFRAME in your first post.

Ramesh S 129 Posting Pro

Hi,

The connection string for MySQL in ASP.NET is as follows:

Server=localhost;Port=3309;Database=Test;Uid=username;Pwd=password;

Refer the following link.

Connection strings for MySQL

Ramesh S 129 Posting Pro

Hi,

Since you are trying to set the url "https: //www.vcs.co.za/vvonline/ccform.asp" which is not in the same domain, The iframe may not be refreshed due to browser security reasons. If you set the url from the current domain, it will work. Otherwise you need to set the url from code behind(.cs) as it executed from a full postback.

Ramesh S 129 Posting Pro

Hi,

If you want to bypass the loading of IFRAME in page load and re-load the url (src property of IFRAME) later, then set src property to empty string("") in the HTML markup (.aspx page). You can set the url in your .cs code as follows.

protected void Button1_Click(object sender, EventArgs e)
    {
        iframecredit.Attributes.Add("src", "https://www.vcs.co.za/vvonline/ccform.asp");

    }
Ramesh S 129 Posting Pro

Hi,

It could be caused due to any number of reasons. Check the following:

1. Ensure that the web service is not blocked by the anti virus installed in your PC/Network.
2. Pass credentials to access the web service if required. Refer the following links.

HOW TO: Pass Current Credentials to an ASP.NET Web Service
A connection attempt failed because the connected

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi,

You cannot retain value in FileUpload control due to security reasons. Also you cannot save the file entered manually in the FileUpload control. You can upload the file only if the file is browsed and selected by clicking the 'Browse' button.

Please refer the following link.

http://forums.asp.net/p/1155617/1896657.aspx

Ramesh S 129 Posting Pro

Hi,

Glad to hear that you found a solution. Please mark this thread as solved.

Ramesh S 129 Posting Pro

Hi,

Since the form's border is drawn by the OS, It is difficult to change and also not advisable.

You can try to use the CodePlex Project for Drawing Custom Borders.It is a small library that extends Windows Forms with ability to customize the windows's non-client area.

You can also try the solution given in the following MSDN Forum thread.

Change Form Border Color

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi,

To analyze the problem, It would be better if you post the method/complete code snippet where this error occurs. Because this error could be occurred due to issue in the other lines of code. Please provide the VS and asp.net project version details.

Also refer following links.
http://msdn.microsoft.com/en-us/library/8dy0ah20%28v=vs.80%29.aspx
http://stackoverflow.com/questions/3764476/vb-net-linq-to-datatable-error-end-of-statement-expected
http://www.dreamincode.net/forums/topic/195427-end-of-statement-error/

Ramesh S 129 Posting Pro

Hi,

Check if the following link will help you to sort out the issue.

Funny Problem: Windows 7, IIS 7.5: Images, CSS not showing!

Ramesh S 129 Posting Pro

Hi,

Do you mean that the FileUpload control is working properly in other pages where UpdatePanel control is used?

Ramesh S 129 Posting Pro

Hi,

The FileUpload control is not not compatible with UpdatePanel control. Please read section 'Controls that Are Not Compatible with UpdatePanel Controls' in the following MSDN link.

UpdatePanel Control Overview

Alternatively, You can try to use the following solutions:

Simple AJAX File Upload

swfupload - It is a third party component which uses javascript and flash. It is free and open source.

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi,

When you run the website admin tool, it will refer the membership provider connection string from machine.config file if your local web site does not have that information.

By default, the membership provider connection string in the machine.config may refer to the SQL Express instance(refer LocalSqlServer) and aspnetdb.mdf database file.

Hence when you try to run the Website Admin Tool from your site, it tries to connect to the SQL Express database. If the SQL Express instance or database is not found, it may return the timeout error. To avoid this, provide connection string details for the membership provider in your local web site.

Refer: How To: Use Membership in ASP.NET 2.0

Ramesh S 129 Posting Pro

Hi,

Change Response.BinaryWrit() as follows and try it.

Response.BinaryWrite(DirectCast(myDataReader.Item("IMAGECONTENT"), Byte()))

or

Response.BinaryWrite(CType(MyDataReader.Item("IMAGECONTENT"), Byte()))
Ramesh S 129 Posting Pro

Hi,

Try the following code.

Dim resultRows() As DataRow 
resultRows = GetContentSet.Tables("Batteries").Select("WithoutHypons = '" & val & "'")
If resultRows.Count() >0 Then
 Public GetMB As DataRow = resultRows(0)
 If GetMB("id") = Nothing Then
      lblStatus.Visible = True 
  Else
     Response.Redirect(String.Format("/MBProduct.aspx?ref={0}", GetMB("id")))
     Page.DataBind()
  End If
End If
Ramesh S 129 Posting Pro

Hi,

Put a break point in the method, step into each line of code and see which line is throwing the error. For example, the following line could cause the problem.

GetMB = GetContentSet.Tables("Batteries").Select("part = '" & val & "'")(0)

The DataTable.Select(string) method will return the array of DataRows that match the filter criteria. If the condition fails, it will return empty array. But you are trying to get the first row using the Select("part = '" & val & "'")(0) part without checking whether the Select condition returns an array of datarows.

Ramesh S 129 Posting Pro

Hi,

What do you mean by 'Common Controls' in asp.net?

Are you referring the controls put inside an User Control?

Please provide more details.

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,

GridView.SelectedIndexChanged Event occurs when a row's Select button is clicked, but after the GridView control handles the select operation. GridView.SelectedIndex property returns the zero-based index of the selected row in a GridView control. You are trying to assign the row index to the PageIndex property which is completely wrong.

Ramesh S 129 Posting Pro

Hi,

Just check the control's ID found in the JavaScript and ID tag of the image control in the HTML source. You can do it by Right click->View Source.

Ramesh S 129 Posting Pro

The HttpApplication.AcquireRequestState event occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request.

Since you used to redirect to timeouterror page in the Application_AcquireRequestState event, first time it redirects to timeouterror page.

Why do you redirect to timeouterror page in Application_AcquireRequestState event?

Ramesh S 129 Posting Pro
Ramesh S 129 Posting Pro

Hi,

The index.aspx is set as the default document to your web site. You can change or remove it in IIS 6.0 using the following steps:

1. Open the IIS ( Start->inetmgr)
2. In the IIS, Expand Server Name->Web Sites->Right click on your site->Select Properties menu
3. In the Properties dialog box, Click on the Documents tab
4. In the List box Under the 'Enable default content page' checkbox, you can add new content page (.aspx page) or change the order of the existing default pages using Move Up and Move Down buttons. Based on this settings, your site will display the default page when the url is typed.

Also refer this link: Setting Up Default Documents (IIS 6.0)