❔ save checkbox value after refresh
Is there a way in Blazor where I save the checkbox after I refresh the page, for example I press a checkbox and I refresh the page and the checkbox sould stayed clicked
9 Replies
You could save to browser or local storage , session storage would only save it for the current browser session which is what you are probably looking for
not really, in my database i have a column with "IsPlannable", "IsPlannable" checks if its true or false, so even it i close the programm an i checked a Checkbox it should show me the enabled checkbox, but i dont know how ti implement that
Ohh , well do you have wasm with server or ?
Because the way i do that in blazor is i make a call to my api to read or write from database using usermanager, if the value is stored in the users table
If thats the case you would prob just read the values of the database when rendering the page with the checkboxes and set them to the values of the dB
Im talking about if you have users logged in using identity tho might be a better way
so about the user log, we use SSO, and i have a class with query about the "IsPlannable"
yes ig
Then yeah would prob be able to read or write from a controller
Yes, but I'm not sure how to do it because I also use Telerik and I can't find any documentation for it
or maybe i just need a method and but it into the GridBox
so i wrote i method, but im not sure where to implement it, i tried in "GridCheckboxColumn" but that doesnt work
if you need the hole code
Not sure, first i would prob let telrik know the isPlannable property is bindable by adding a Bindable tag to it( if one still does that ) `
That tells Telerik grid component to treat this property as bindable. Then it can be bound to a checkbox
Im not so used to Telerik tho i might be wrong as i said.
Then maybe use this:
`
This will create a checkbox in the grid that is bound to the IsPlannable of each employee.
Then modify the SaveData method to update the plannableEmployees list instead of updating allEmployees
But as i said, if you have a DB, you prob need to make a API call to that DB to read/write, in my case, i usually create the database write/read stuff in my controllers, then i can access data or change using calls to the API.
If you are using entity framework core you can do something like this:
`
Dont listen to everything i say tho because i am not 100%, prob others in this discord who know way more about this. Im just giving you examples
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.