215
Points
Questions
41
Answers
48
-
Asked on July 17, 2020 in XML.
I waited a while but got no answer so I solved the problem by having a helper function in the nested control to enable to set the property at runtime.
public void SetCounterType(integer countertype) { //after checking that countertype is a valid value m_countertype = countertype; }
then in the constructor for IntervalEdit:
public IntervalEdit(Context context, AttributeSet attrs) { TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.IntervalEdit, 0, 0); //other attributes read here m_counterstyle = array.getInt(R.styleable.IntervalEdit_counterstyle, R.integer.counter_simple); (ThirtySecondIncrement)findViewById(R.id.tsi).SetCounterStyle(m_counterstyle);
The SetCounterStyle function in the first custom control only sets the variable and doesn’t force a redraw enabling me to call it from within the including custom control’s constructor. Any, that’s how I solved it.
- 419 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in XML.
If you would like to open a servlet with javascript without using ‘form’ and ‘submit’ button, here is the following code:
var button = document.getElementById("<<button-id>>"); button.addEventListener("click", function() { window.location.href= "<<full-servlet-path>>" (eg. http://localhost:8086/xyz/servlet) });
Key:
1) button-id : The ‘id’ tag you give to your button in your html/jsp file.
2) full-servlet-path: The path that shows in the browser when you run the servlet alone
- 721 views
- 11 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
MAUI is the next generation of Xamarin Forms with broader platform support. The first preview will be available in .NET 5 in Nov 2020, and the first production release will come with .NET 6 in Nov 2021.
Xamarin Forms will be supported for one year after MAUI is introduced in 2021, then will be deprecated in favor of MAUI.
- 477 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
You could do it like this.
thang.json
is a file with json you provided.var json = File.ReadAllText("thang.json"); var deserialized = JsonConvert.DeserializeObject<dynamic>(json); if (new[] {"PSTN", "UIFN", "TS", "RS", "TF"}.Contains((string) deserialized.Phone)) { Console.WriteLine(deserialized[(string)deserialized.Phone]); }
- 334 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
This will be a part of your view, such as Index.csthml. With all due respect, I would suggest reviewing ASP.NET Core MVC training videos from YouTube. There are several good ones that help explain the basics.
- 408 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
If one is getting this message during saving or compiling the build, just close all the files and then open any file to compile and save.
For me the reason was that I had rename the file and old file was still open.
- 1189 views
- 28 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
and thanks a lot for your response,
I do like that but unfortunately it does not work yet the update has not done
@foreach (var item in Model.bananes) { <div class="col-md-4"> <form asp-action="ViewEdit" method="post"> <div asp-validation-summary="ModelOnly" class="text-danger"></div> <input type="hidden" [email protected](modelItem => item.id)> <div class="form-group"> <label asp-for="@item.Name" class="control-label"></label> <input class="form-control" value="@Html.DisplayFor(modelItem => item.Name)"> </div> <div class="form-group"> <label asp-for="@item.Color" class="control-label"></label> <input class="form-control" value="@Html.DisplayFor(modelItem => item.Color)"> </div> <div class="form-group"> <label asp-for="@item.BananeP" class="control-label"></label> <input class="form-control" value="@Html.DisplayFor(modelItem => item.BananeP)"> </div> <div class="form-group"> <input type="submit" value="save" class="btn btn-info text-white " /> </div> </form> </div>} public IActionResult ViewEdit( [Bind("id,Name,Color,BananeP ")] Banane item) { _context.Update(item); _context.SaveChangesAsync(); return RedirectToAction("Index");}
- 377 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
Assuming your tab content is a type
TabContent
with a propertyHeader
and you bind your items via theItemsSource
property, you can do this.tabControl.SelectedItem = TabControl.Items.OfType<TabContent>().SingleOrDefault(ti => ti.Header.Equals(myHeader));
If you directly assign
TabItem
s to yourTabControl
, you can do this.tabControl.SelectedItem = tabControl.Items.OfType<TabItem>().SingleOrDefault(ti => ti.Header.Equals(myHeader));
Since both examples use Linq for convenience, be sure to import it with
using System.Linq;
. TheOfType<T>()
method will filter the items for a specific type andSingleOrDefault()
will return a single element that matches the criteria ornull
, which would mean that no tab item is selected.- 406 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
I think the problem might be with your if statement in updatePost function
if (isset($_POST['featured_image'])) {
. Change this like in createPost function$featured_image = $_FILES['featured_image']['name']; if (empty($featured_image)) { ... }
Check also https://www.php.net/manual/en/features.file-upload.post-method.php for more information about checking uploaded files.
- 530 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
Please add semicolon ; after the mysql code.
- 360 views
- 2 answers
- 0 votes