Skip to content

Infragistics Community Forum / Desktop / Ultimate UI for Windows Forms / Getting checkbox value from UltraGrid

Getting checkbox value from UltraGrid

New Discussion
Mohsin Alvi
Mohsin Alvi asked on May 5, 2021 6:58 AM

Hi Anyone please help me with this. My Grid Contains a checkbox column. I want to pass the checkstate as value to stored procedure parameter .

foreach (UltraGridRow row in grdModuleScreens.Rows)
{
if (row.Cells[“Access”].Value.ToString().Equals(“True”))
{
command.Parameters.AddWithValue(“@Access”, 1);
}

else

{
command.Parameters.AddWithValue(“@Access”, 0);

}
}

i am using this code but it is not working properly. As exception message states “TOO MANY ARGUMENTS PASSED TO STORED PROCDURE”

Sign In to post a reply

Replies

  • 0
    Andrew Goldenbaum
    Andrew Goldenbaum answered on May 3, 2021 5:11 PM

    Hello Mohsin,

    I believe the code you are using to get the actual checkbox value from your UltraGrid is correct in this case and the error that you are receiving is purely related to the stored procedure call to command.Parameters.AddWithValue.

    Personally, I am not very well versed in stored procedures in this case, but this is not something that Infragistics controls. Still, I have been doing some research on this, and I would recommend taking a look at a couple of the following threads as they may help you to resolve this error you are seeing:

    https://www.codeproject.com/Questions/1233551/How-to-avoid-stored-procedure-has-too-many-argumen.

    https://stackoverflow.com/questions/23645772/stored-procedure-has-too-many-parameters-when-being-called

    Please let me know if you have any other questions or concerns on this matter.

    • 0
      Mohsin Alvi
      Mohsin Alvi answered on May 3, 2021 8:39 PM

      Hi Andrew,

      Thanks for the prompt reply. Actually Stored Procedure is working fine if i hardcode @Access value to 1 or 0.

      What i need is how to find that current state of checkbox is 1 or 0? and in which event i need to put this foreach loop?

      • 0
        Andrew Goldenbaum
        Andrew Goldenbaum answered on May 3, 2021 10:56 PM

        Hello Mohsin,

        It appears from your code that you should already have the information that you need regarding whether the checkbox value is 1 or 0, as this should correspond to true and false, and you are already checking the cell value for true or false?

        Regarding which event to place the foreach loop, as long as the UltraGrid is loaded and has its Rows collection populated, you should be fine. Anything after the Form’s Load method should be a valid place to put your code.

        Please let me know if you have any other questions or concerns on this matter.

      • 0
        Mohsin Alvi
        Mohsin Alvi answered on May 5, 2021 6:58 AM

        Thanks for the reply Andrew. But it is not assigning 1 0r 0 value to @Access parameter. I dont know why. Let me figure out other way. 

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mohsin Alvi
Favorites
0
Replies
4
Created On
May 05, 2021
Last Post
4 years, 10 months ago

Suggested Discussions

Created by

Created on

May 5, 2021 6:58 AM

Last activity on

Feb 20, 2026 12:21 PM