locked
Easy VB to C# script RRS feed

  • Question

  • User-1266225229 posted

    I have an issue with masterpage/content page and login control validators, I found this thread written in VB (http://forums.asp.net/t/1191307.aspx)  and need to convert it to C# (I have tried a conversion tool but no good) many thanks Paul

     

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
                ValidationSummary1.ValidationGroup = Replace(Login1.ClientID, "_", "$")
        
    End Sub

    Friday, April 24, 2009 7:48 AM

Answers

  • User-1171043462 posted

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
                ValidationSummary1.ValidationGroup = Replace(Login1.ClientID, "_", "$")
        
    End Sub

    Here it is

    protected void Page_Load(object sender, System.EventArgs e)

    {        

        ValidationSummary1.ValidationGroup = Strings.Replace(Login1.ClientID, "_", "$");

    }

    Remeber there's a tool avialable that does for you online

    http://www.developerfusion.com/tools/convert/vb-to-csharp/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 24, 2009 8:45 AM

All replies

  • User100899815 posted
        protected void Page_Load(object sender, EventArgs e)
        {
         
            System.Text.StringBuilder sb = new System.Text.StringBuilder(Login1.ClientID);
            sb.Replace("_","$");
              ValidationSummary1.ValidationGroup = sb.ToString();
          
           

        }
    Friday, April 24, 2009 8:42 AM
  • User-1171043462 posted

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
                ValidationSummary1.ValidationGroup = Replace(Login1.ClientID, "_", "$")
        
    End Sub

    Here it is

    protected void Page_Load(object sender, System.EventArgs e)

    {        

        ValidationSummary1.ValidationGroup = Strings.Replace(Login1.ClientID, "_", "$");

    }

    Remeber there's a tool avialable that does for you online

    http://www.developerfusion.com/tools/convert/vb-to-csharp/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 24, 2009 8:45 AM
  • User-1266225229 posted

    Thank You!! thats got it firing, marked as answer, cheers Paul

    Friday, April 24, 2009 11:18 PM