Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
0
@bind-Value integer to IgbInput error
posted

Hi I am trying to bind an integer to the Input of a "IgbInput" Form control but get an error?

error:

InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.

code:

<p>ID: <input type="number" @bind-value="@id" @bind-value:event="oninput" /></p>
<IgbInput DisplayType=InputType.Number Label="ID" Placeholder="User Id" Class="input" @bind-Value="@id"></IgbInput>

<button type="submit" @onclick="@(x => RouteWithId(@id, bShowCount))">
Submit Id
</button>

@code {
public int id { get; set; }
public void RouteWithId(int id)
{
      NavManager.NavigateTo($"/routeexample/{id}");

}

If I use the HTML "input" everything works fine...

Any help would be greatly appreciated.

Parents
No Data
Reply
  • 28925
    Offline posted

    Hello Steve, 

    Thank you for contacting Infragistics. As of right now, you are correct the only type you can use is string. An issue was submitted on our github page that you may follow. 

    github.com/.../20

    Let me know if you have any questions.

Children
No Data