.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

'/>

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :ASP.Net
 
Hi all,Here's some simple code<a href='<%= string.Format("../Print/Print1.aspx?withParameter={0}", Para )%>'>HyperLinkText</a>and it works well. so i guess i can write anything like this, so i wrote a test:<input type="button" value="Btn1" onclick='<%= string.Format("window.open('','_blank')") %>'/> <input type="button" value="Btn2" onclick="window.open('','_blank')"/>However, Btn1 does not work.. for some reason i have to NOT to use server control, so i wite it in inline-code style,why the first hyperlink work well, but Btn1 fails?could anyone tell me?thank you~


View Complete Post


More Related Resource Links

Object expected error

  

<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected

 

timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance


Button in datalist, open new window with query string

  
hi everyone,i'm writing a button which need to open a new window and sending binded data as query string:<asp:DataList ID="DataList_Comment" runat="server" DataKeyField="Comment_id" DataSourceID="CommentDataSource" Width="482px"> <ItemTemplate> .... <br /> <input type="hidden" name="comment_id" id="comment_id" value='<%# Eval("Comment_id") %>' /> <input id="Button1" type="button" value="button" onclick="open_win(comment_id.value)" /> </ItemTemplate> </asp:DataList> here is the open_win function:<script type="text/javascript"> function open_win(id) { var url = "Report.aspx?type=comment&id=" + id; window.open(url); } </script> But the url created is ".../Report.aspx?type=comment&id=undefined", the queryString["id"] is not defined.In the calling page source html, comment_id has value.<input type="hidden" name="comment_id" id="comment_id" value='2' /> How can i set the variable value of "comment_id" in button onclick, to call the javascript o

Response.Write(string.Format("", url));

  

Hello all,

Any suggestions are greatly appreciated...

Here is the website situation:

Webpage A: look & feel alignments are in the central of the screen.  It has a submit button.  The last code in the submit command() is this message subject:

Response.Write(string.Format("<script>window.open('{0}', '_blank');</script>", url));

where url = another webpage B.


The outcome is fine.  Webpage B is populated properly.  However, Webpage A postback as aligment to the left, it is no longer the center. 

I could not find a way to debug the issue.


Once again, thanks in advance.



Parsing string as a Button type reference in Visual c#

  

So basically, id like to parse the name of a string as an Button reference, and then alter the properties of that particular button with the reference being the same as the string parsed.

something like

Button b101 = new Button();

this.Controls.Add(b101);

s="b101";

boxlight((Button)s);

 

 private void boxlight(Button obj)
        {
            obj.BackColor = Color.RED;

}

however explicit type casting for this conversion is not supported.

 


[img]http://img260.imageshack.us/img260/8141/elfenlied1signaturedarkross17q.png[/img]

Input string was not in a correct format.

  

Hi, I just started learning asp.net

i set simple application but i get this error that  "Input string was not in a correct format"

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 10:     protected void Page_Load(object sender, EventArgs e)
Line 11:     {
Line 12:         decimal num1 = Decimal.Parse(txtNumber1.Text);
Line 13:         decimal num2 = Decimal.Parse(txtNumber2.Text);
Line 14:         decimal ans = num1 + num2;

How can I correct this error

 

thanks

 


Input string was not in a correct format.

  
I am trying to convert a null value to a double value using convert function in C#. Can anybody help me in this regards... I am getting a null value in a variable named "gridCol1" Step 1 - I am doing                Convert.ToDouble ( gridCol1.ToString() );                Error : "Input string was not in a correct format."

My problem with an gridView, Input string was not in a correct format.

  
Hello all ! I'am actually encounter problem with an gridView which is composed of five columns, the both first are string type, third is date and the two last are linkbutton to edit or delete rows. On clicking edit button, i catch good event to edit and traitment  work fine but on living function an error occur with this message : error : System.FormatException: Input string was not in a correct format. stackTrace :   [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119 System.Web.UI.WebControls.GridView.GetRowIndex(GridViewRow row, String commandArgument) +99 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +602 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean inclu

MSG durring Installatioin:Input String was not in a correct format

  
I am in the process in installing SQL  Express 2008-R2. While running Setup, the following box pops up: SQL Server Steup faulure. SQL Server Setup has ecountered the following error: Input string was not in a correct format... Any ideas on how to correct this? Thanks in advance.  

Input string was not in a correct format.

  

DropDownList ddlCardDetails = LoginView2.FindControl("ddlCardDetails") as DropDownList;

        BurnbetDataContext ctx = new BurnbetDataContext("data source=.\\SQLEXPRESS;Integrated Security=SSPI;" +
                           "AttachDBFilename=|DataDirectory|\\BurnbetDatabase.mdf;User Instance=true");



            int Id = Convert.ToInt32(ddlCardDetails.SelectedValue.Split('|')[0]);
            tbl_Payment democustomer = ctx.tbl_Payments.SingleOrDefault(c => c.ID == Id);


        if (democustomer != null)
        {


            ctx.tbl_Payments.DeleteOnSubmit(democustomer);
            ctx.SubmitChanges();
        }

        GetCardDetails();

    }

Input string was not in a correct format

  

I am trying to update a coulmn in datatable but keep getting error:

Input string was not in a correct format.Couldn't store <&nbsp;> in SortOrder Column.  Expected type is Int32.

SortOrder is column of Type Integer that either contain Null or number.

Any ideas? below is my code

   If e.CommandName = "Reset" Then
            Dim index As Integer = Integer.Parse(e.CommandArgument)
            dt = CType(Cache("dt"), DataTable)
            Dim value As Integer = 0
            value = Convert.ToInt32(dt.Rows(index)("ContentID").ToString())


            Dim SortOrderNum As Integer = 0
            SortOrderNum = dt.Rows(index)("SortOrder").ToString()
            dt.Rows(index)("SortOrder") = DBNull.Value   'dt.Rows(index - 1)("SortOrder")

            dt.AcceptChanges()
            dtNew = dt.Copy()
            dgArticles.DataSource = dt
            dgArticles.DataBind()
            dt.AcceptChanges()
            Dim i As Integer = 0
            For i = 0 To dgArticles.Rows.Count - 1
                dtNew.Rows(i)("ContentID") = dgArticles.Rows(i).Cells(0).Text

                dtNew.Rows(i)("Headline") = dgArticles.Rows(i).Cells(1).Text

                dtNew.Rows(i)("SiteName") = dgArticles.Rows(i).Cells(2

{"Input string was not in a correct format."}

  

  Trying to write a web Service.

Common.cs

namespace HL7InterfaceWebServiceLibrary
{
  public class Common : ICommon
  {
    private ClientPatientID CPI = null;

 public ClientPatientID GetClientPatientID(string caseNum)
    {
      CPI = new ClientPatientID();
      string caseNo = caseNum.Trim();
      using (var cnn = new SqlConnection(Properties.Settings.Default.ConnectionString))
      {
        try
        {
          using (var cmd = new SqlCommand("[HL7].[GetClientPatientID]", cnn))
          {
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@CaseNo", caseNo));
            cnn.Open();
            using (SqlDataReader myreader = cmd.ExecuteReader())
            {
              while (myreader.Read())
              {
                CPI.CPatientID = Convert.ToInt32(myreader["ClientPatientID"].ToString());
              }
            }
          }
        }
        catch (Exception ex)
        {
          throw;
        }
        finally
        {
          cnn.Close();
          cnn.Dispose();
        }
      }
      return CPI;
    }


}

ICommon.cs

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace HL7InterfaceWebSer

Serious problem on UpdatePanel and GridView (Input string was not in a correct format)

  

I have implemented a custom gridview paging method using the pagertemplate tag. The source code is the following:

 

 

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
      		<ContentTemplate>
      		<fieldset class="ads">
			<legend>?????????</legend>
			<br />            
            <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False" DataKeyNames="CHId" CssClass="grid" GridLines="None" AllowPaging="true" AllowSorting="true&q

Enterprise Library 4.0 error: Input string was not in a correct format.

  

I am trying to insert candidates information into SQL Server database. I have written the corresponding stored procedure like below in SQL server:

ALTER PROCEDURE [dbo].[USPInsertCandidate]
	@candidate_name varchar(60),
	@dob datetime,
	@gender char,
	@current_location varchar(60),
	@mobile_no_one varchar(20),
	@mobile_no_two varchar(20),
	@home_phone	varchar(20),
	@work_phone varchar(20),
	@email_id varchar(100),
	@passport varchar(20),
	@as_on_date datetime,
	@file_upload_path varchar(255),
	@availability char,
	@applied_position varchar(30),
	@max_round_id int,
	@certification_comment varchar(2000),
	@source_id int,
	@source_comment varchar(2000),
	@skillset_comment varchar(2000),
	@max_status_id int,
	@total_exp_year int,
	@total_exp_month int,
	@source_date datetime,
	@user_id int,
	@visa varchar(20),
	@qualification varchar(100)
AS
BEGIN
	declare @candidate_id int;
	set @candidate_id = dbo.GetCandidateID();
	insert into candidates(candidate_id, candidate_name, dob, gender, current_location, mobile_no_one, mobile_no_two, home_phone, work_phone, email_id, 
							passport, as_on_date, file_upload_path, availability, applied_position, max_round_id, certification_comment,
							source_id, source_comment, skillset_comment, max_status_id, total_exp_year, total_exp_month, source_date,
							user_id, visa, qualification)
	values

Input string was not in a correct format.

  
what is this error.what wrong in this code

Class1 obj1 = new Class1();
            Console.WriteLine("Enter Any Two Numbers");
            obj1.PNum1 = Convert.ToInt32(Console.ReadLine());
            obj1.PNum2 = Convert.ToInt32(Console.ReadLine());
            obj1.add();
            Console.WriteLine("Sum is:" + obj1.PResult);
            obj1.Multiply();
            Console.WriteLine("Muliply is:" + obj1.PResult);
            obj1.Divide();
            Console.WriteLine("Product is:" + obj1.PResult);
            obj1.Subtract();
            Console.WriteLine("Substract is:" + obj1.PResult);



Deleting formatted record returns "Input string was not in correct format"

  

I have a bound data field, a detailsview, one of the records I have formatted to currency in the item template. Yet when I go to delete a record, I get a error message "Input string was not in correct format". Take away the formatting and the page runs fine. I tried changing the datatype from int to money, it makes no difference. Ideas? 


Input string was not in a correct format

  
I'm having some intermittent trouble with an editform that I have heavily customized.  I think I have it narrowed down to the offending part but I'm stuck on how to fix it.

My page is an editform with tabs created from here: http://www.sharepointchamps.com/?p=21#more-21
And a cascading dropdown menu (which I think is the problem) created from here: http://mdasblog.wordpress.com/2009/07/14/cascading-columns-in-a-sharepoint-form/

Intermittently, when I access the form and either hit OK or Edit Page I get the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Input string was not in a correct format. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer

Strange "Input string was not in a correct format" after upgrading to .net 4.0 (VS 2010)

  

Hi guys, I am at a loss here.  I have a gridview that was displaying and handling postbacks correctly, that is, until I upgraded to .net 4.0 (vs 2010) from .net 3.5. Now I am getting the classic (and in this context meaningless) "Input string was not in a correct format" error upon postback. The postback is initiated by a command button and the row command event handles everything nicely.

The trace shows internal grid postback handling and nothing else:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +9594283
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
   System.Convert.ToInt32(String value, IFormatProvider provider) +48
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +1047
   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +210
   System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
 

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend