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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

problem on indexOf() method

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net


Whats wrong in this code? I can not use indexOf method.

        function CancelPostback() {
            var TextBoxDescription
            TextBoxDescription = document.getElementById('<%=(((Master.FindControl("MainContent")).FindControl("FormViewPO")).FindControl("DescriptionTextBox")).ClientID %>');
            alert(TextBoxDescription.value)  // working. Alert shows value of the textbox
            //  alert(TextBoxDescription.value.indexOf("a")) // not working. even no alert
            //  alert(TextBoxDescription.indexOf("a")) // not working. even no alert
            //  alert(TextBoxDescription.value.indexOf('a')) // not working. even no alert
            //  alert(TextBoxDescription.indexOf('a')) // not working. even no alert

View Complete Post

More Related Resource Links

Problem with Finder method with parameters



Could someone explain me how to provide some value to the parameters in a finder method. For exemple I know that the BDC list WP use this method. Is there a way to provide some value for those parameter at runtime? I really don't understand (even after some deep search on the web) where are the values for the parameters from and how we can connect to them. Even with C# code I can't find any information on how it work.

I don't want to define my parameters as filter in the ADF because then I will have this filter section in my BDC list WP (or is there a way to get rid of that?). Actually one of the parameter should be automatically calculated from a value in a SP list, the other parameter should be provided by my own filter web part.

Thank you for your help.

Problem with overriding OnPaint method of System.Windows.Forms.Textbox

Hi,   I want to change the border colour of the Textbox. However, when I override the OnPaint method, some strange behaviour occurs.   The new border is drawn, as is the textbox background. However, the text itself appears in bold and only while I actually type something in, afterwards it disappears. I have provided a sample of my code here:         protected override void OnPaint(PaintEventArgs e)         {             base.OnPaint(e);             Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);             ControlPaint.DrawBorder(e.Graphics, rect, _BorderColour, ButtonBorderStyle.Solid);         }   I have also set the style of the control to Userpaint, so that the paint method is actually used. Does anybody know how to solve this issue?

Problem using value() method for xml datatypes.

Hi i'm working on an application which stored infopath forms in database as xml datatype. now i want to get query of xml data which returns each node as sql dataType (column). here is my sample form data : <?mso-infoPathSolution solutionVersion="" productVersion="12.0.0" PIVersion="" href="file:///D:\customForm3.xsn" name="urn:schemas-microsoft-com:office:infopath:customForm3:-myXSD-2010-09-11T10-56-47" ?> <?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?> <my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-09-11T10:56:47" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-us"> <my:txtFirstName>test1</my:txtFirstName> <my:txtLastName>test2</my:txtLastName> <my:txtFatherName>test3</my:txtFatherName> <my:txtNationalCode>8278273828</my:txtNationalCode> <my:cmbReuqesType>2</my:cmbReuqesType> <my:dtmRequestDate>2010-09-17</my:dtmRequestDate> <my:txtDescription>test4</my:txtDescription> </my:myFields> to get query of this

Problem with IndexOf function in Java script?


Hi all,  i have one problem while using Index Of function in java script. I am using this in this way:

var ss=(document.getElementById('<%=HiddenField1.ClientID%>').value.indexOf(","+document.getElementById('<%=yyy.ClientID%>').value+"-"+document.getElementById(str).value,20));                       

Problem canceling asynchronous method



I want to canceling an asynchronous method.

How can me it?


public IAsyncResult BeginGetAllUsersCount(object sender, EventArgs args, AsyncCallback callback, object state)
       //Canceling asynchronous operation
     return AdapterUser.BeginGetAllUsersCount(callback);

   public void EndGetAllUsersCount(IAsyncResult asyncResult)
     _totalRowsCount = AdapterUser.EndGetAllUsersCount(asyncResult);




Problem while calling WCF method


I have a WCF Service and a client application. WCF Service has an operation contract (say UpdateTables()) with IsOneWay = True. I call this method of WCF Service from my client application using the code below:
   Private Sub UpdateTable_Client()
        Dim WCFSvcObject As New MyFirstWCFServiceClient
        Dim WCFSvcData as new MyFirstWCFDataRequest 'DataContract object
        WCFSvcData.TableName = "Customer"
        WCFSvcData.ColumnName = "Name"
        Catch ex As Exception
            Throw ex
            If WCFSvcObject  IsNot Nothing Then               
            End If
        End Try
    End Sub

Sometimes this call reaches to WCF Service successfully but sometime it lost and UpdateTable() method could not be invoked on service side. I am not sure but I think WCFSvcObject.Abort() code aborts the WCF request before it reaches to the service. I can not use Close() method here as my client application hangs on the Close().
Please suggest me what may be the reasons of the client call could not reach to the WCF Service. Should I not use Abort() method. If yes then how can I dispose the WCF proxy(since Close() method is not working here).

Problem creating method?


I added the extender and when i tried to add the method this message poped up;

Cannot create page method "GetCompletionList" because no Code Behind or codefile was found.

does anyone know why this is happening?

Thanks  =)

Unusual problem using a class method


I have a class that runs calculations on numbers and populates the results to my SQL database.  My code behind page instantiates the class object, and in a loop it makes use of the method five times (once per loop).  Essentially, my code behind collects the information from controls and passes the information to the class method for processing.  The method works just fine most of the time.

On one of the iterations I get a error before the code even gets to the class.  The error is, "Arithmetic operation resulted in an overflow."  What strikes me as odd is that while stepping through the code, the loop crashes with that error before getting to the class that runs the calculations.  Additionally, no arethmetic operations are performed on the form's code-behind page (which calls the method).  I even put a break-point on the class constructor but the code crashed before reaching that constructor.

The information being sent is the results of matches from a sporting event.  As a troubleshooting measure I changed the order of the matches by deleting them an re-entering them into the database in a different order.  Again only this one particular match crashed.

Here is the code that crashes:

cRating.SetRating(dMatchDate, iSetID, 8, iHPlayerID, 

problem with my method


this method is meant to retrieve two database field values, but i'm getting error: Must declare the scalar variable "@FlyingFrom".

 public static string GetDepartureFlightId()

            //sql query
            string sqlQuery = @"SELECT DepartureId
                                FROM Flights WHERE FlyingFrom = @FlyingFrom"; 

            using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString))
                string depId = "";
                string flyingFrom = "";
                SqlCommand myCommand = new SqlCommand(sqlQuery, myConnection);

                SqlDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);

                while (reader.Read())
                    depId = reader["DeparturedId"].ToString();
                    flyingFrom = reader["FlyingFrom"].ToString();


                return sqlQuery;


Problem in inserting another entity via overriding insert method


I have problem to inserting another entity in overriding method of first entity my code sample is like bellow :

partial void InsertEntity1 ( Entity1 instance )


     Entity2 x = new Entity2() ;

tihs.Entity2s.Add(x) ;





in inserting Entity2 I get Exception "The Operation Cannot be perform for the entity because it is not being change track"


DataBinding + Extension Method Problem


Inside my repeater I'm calling an extension method like so:


<asp:label id="fileSize" runat="server" text='<%# ((UploadedFile)DataBinder.GetDataItem(Container.DataItem)).Size() %>' />


he above is giving me an "Object not set to an instance of a object" exception inside the extension method. If I comment the above expression out, it works fine, and the items are binded wtih no problems. Any ideas?

Problem with the XMLNodeList.SelectSingleNode method



I was doing an experiment with the XML. Bellow given is XML file


I have written the following piece of code to get the NodeList

private ConfigData ReadConfig()
            XmlDocument powerDoc = new XmlDocument();
            ConfigData config = null;
            XmlNode node = null;
            XmlNodeList emailList = null;

Problem in firefox and safari to call ajax method?


why does my below method not work with firefox and safari, every time it goes on OnFailed method?

is there setting requirement in browser to call page Method ?

also In IE method is calling sucessfully, but why alert message does not come ?

function SendMessage() {
      var user = document.getElementById('<%=User.ClientID %>');
      var val = user.value;
      var random = 2345;
      var nonRandom =12345;
        var toAddress = val;
        PageMethods.SendResetMailMessage(toAddress, random, nonRandom, CloseWindow, OnFailed);

    function CloseWindow(ret) {
      // Below code is usedOnClick="OnForgotPassword_Click" to close the window, if mail has been sent to the user sucessfully.
      if (ret == "1") {
        var windowObj = window.self;
        windowObj.opener = window.self;

Problem with Graphics.DrawImage method in .Net on Windows 7 OS



We are displaying bitmap image on winform header in our dotnet application. It is displayed well on all windows operating systems. But, the same dotnet code if it runs on windows7, it does not display the image on the form. Can you please help me? Here is our code:


Dialogbase {


Rectangle captionRect = new Rectangle(0, 0, 0, 0);


Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

Regrading Sharpoint 2010 problem and solutions

We can write your question and problem on this blogger.you get ans.use.
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