[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Line 35

Posted on 2012-03-24
7
Medium Priority
?
481 Views
Last Modified: 2012-03-26
This is the error that I am recieving. Can you help me.  I am a student needing tutoring and guidance.  The following errror is the problem in my program on line 35

Error      1      Property or indexer 'string.this[int]' cannot be assigned to -- it is read only      C:\Users\acer\Documents\TitleCase\Default.aspx      35      25      C:\...\TitleCase\

This is what I am trying to accomplish.

I must create a script that takes text that a user enters into a form field and converts it to title case capitalization.  Use a split()  method to split words in the string into an indexed array.  Then create a for loop that uses another split() method that splits each word in the elements of the indexed array into another another indexed array of characters.  Within the for loop, us he ToUpper() method to convert the first element in the second array (which represents the first characters in the word to uppercase) to uppercase, and then use the Join() method to rebuild the array of words in the text string.  Execute a final Join() method to convert the array of words back into a single text strin.  Save the project as TitleCase
TitleCase.zip
0
Comment
Question by:assaultkitty
7 Comments
 
LVL 36

Expert Comment

by:Miguel Oz
ID: 37761584
Can you post your code?
Default.aspx.cs does not contain any code:
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
0
 

Author Comment

by:assaultkitty
ID: 37761614
No, i do not have any code in it!  I am not using it.  Do I need to use it.  If so, then where do I start.  I got the HTML code to show.  Can you help?
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 37761911
No, i do not have any code in it!  I am not using it.  Do I need to use it.  If so, then where do I start.  I got the HTML code to show.  Can you help?


Show default.aspx as starting page and declare textbox in default.aspx page. And in Default.aspx.cs file, write code in button submit event hander as follow:

Code in .aspx.cs file:
string value = TextBox1.Text;
string upperValue = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value);

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Accepted Solution

by:
Navneet earned 2000 total points
ID: 37762170
Hi!

Create Extension method with vs00asini in codebehind
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

 
}

public static class myString
{
    public static string ToTitleCase(this string Input)
    {
        return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Input.ToLower());
    }

}

Open in new window


And use it in your HTML file

enteredText = enteredText.ToTitleCase();

Open in new window


Thanks!
0
 
LVL 16

Expert Comment

by:Vikram Singh Saini
ID: 37762494
Comment ID: 37762491 at link Line 33 would be the reason and solution for this problem too.
0
 

Author Comment

by:assaultkitty
ID: 37768698
I have to really trust the experts.  I did excellent on this project.   Thank you!
0
 

Author Closing Comment

by:assaultkitty
ID: 37768702
Thanks so much!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question