I'm adding data to Tableview like that.
I would like to export/write these tableview data to txt file for example. I wan't to create event for button.
How could i do that?
lisaTabelisse.setOnMouseClicked(l -> {
if ((eesnimi.getText() == null || eesnimi.getText().trim().isEmpty()) ||
(perenimi.getText() == null || perenimi.getText().trim().isEmpty()) ||
(aadress.getText() == null || aadress.getText().trim().isEmpty()) ||
(email.getText() == null || email.getText().trim().isEmpty()) ||
(telefon.getText() == null || telefon.getText().trim().isEmpty()) ||
(lisaks.getText() == null || lisaks.getText().trim().isEmpty())) {
JOptionPane.showMessageDialog(null, "Kõik väljad on kohustuslikud");
} else {
tableView.getItems().addAll(new Sisendid(eesnimi.getText(), perenimi.getText(), aadress.getText(),
email.getText(), telefon.getText(), lisaks.getText()));
}
});
Thank you for reply.
I managed to add data to txt file. Just a for loop worked well.
I noticed one other moment.
Every time i insert new data, previous rows will be changed according to new data.
So everything will be same in the end.
How should i change that.
Related
I've looked around for a while for an answer but no one has one and everyone keeps saying it's how it's supposed to work.
I need to render an & (ampersand) as plain javascript code. Not as a string.
if (#(Model.Month == null ? "now.getMonth() == tooltipItems[0].index" : "now.getMonth() == tooltipItems[0].index && now.getDay() == tooltipItems[0].index") && now.getFullYear() == $('#DistinctYears').val()) {
//
} else {
//
}
I need this section:
"now.getMonth() == tooltipItems[0].index && now.getDay() == tooltipItems[0].index"
To render as plain javascript code but when it renders, the ampersands automatically get converted to &&
Surround the entire ternary expression with Html.Raw():
#Html.Raw(Model.Month == null ? "now.getMonth() == tooltipItems[0].index" : "now.getMonth() == " + (Model.Month - 1) + " && now.getDate() == (tooltipItems[0].index + 1)")
I have one textbox to search based on staff name and dropdownlist to search based on staff type. if staff name is entered repeater should load based on txtbox text, if dropdown selected load data related to that perticular selected value. if both are present like if textbox value is entered and as well as dropdown is selected load repeater based on both the data.
Below is the code snippet of search option.
int stype = int.Parse(ddlStafType.SelectedValue);
if (txtsearchname.Text == "" && ddlStafType.SelectedValue == "0")
{
idLoadData();
}
else
{
using (iSchoolDBEntities db = new iSchoolDBEntities())
{
var details = (from si in db.School_StaffInfo
join st in db.iSchool_StaffType on si.StaffTypeID equals st.StaffTypeID
where ((si.SchoolID == schlid) && (si.isDeleted != true)) && ((si.StaffName.StartsWith(txtsearchname.Text)) && (si.StaffTypeID == stype) && ((si.StaffTypeID == stype) || (si.StaffName.StartsWith(txtsearchname.Text))))
select new
{
si.StaffID,
si.StaffName,
si.EmployeeCode,
st.StaffType,
si.UserName
});
RptallStaff.DataSource = details.ToList();
RptallStaff.DataBind();
}
}
I'm having a bit of trouble trying to find if my url parameters exist or not.
I have tried the following:
// doesn't work
(Request.QueryString["showTop"] != "" && Request.QueryString["showTop"] != null)
// doesn't work
(Request.Params["showTop"] != "" && Request.Params["showTop"] != null)
I am trying to find the correct value. The full statement looks like:
showTop = (Request.QueryString["showTop"] != "" &&
Request.QueryString["showTop"] != null) ?
Request.QueryString["showTop"] : (10).ToString();
Which works fine, if showTop exists with a value.
This is being done within the view.
Try the following:
showTop = string.IsNullOrEmpty(Request["showTop"]) ? "10" : Request["showTop"];
Assuming you want "showTop"to default to "10".
First check whether QueryString has keys or not by calling this method.
bool qKeys = Request.QueryString.HasKeys();
I have a page with filters and accordingly to what the user selects, it has to generate a query. I'm using this code:
var riskitem = (from risk in context.RisksList
where risk.ProjectCode == sProjectCode &&
(
(search == "" && status == "" && ispublic == TriState.NA) ||
(search != "" && (
(!String.IsNullOrEmpty(risk.Description) && risk.Description.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
(!String.IsNullOrEmpty(risk.Title) && risk.Title.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
(risk.Probability.HasValue && risk.Probability.Value.ToString().IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
(!String.IsNullOrEmpty(risk.Mitigation) && risk.Mitigation.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0) ||
(!String.IsNullOrEmpty(risk.Observations) && risk.Observations.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0)
)) ||
(
(status != "" && risk.Status.Value.ToString() == status) ||
(status == "" && search != "" && risk.Status.Value.ToString().IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0)
) ||
(
(ispublic != TriState.NA && ((risk.IsPublic.Value && ispublic == TriState.True) || (!risk.IsPublic.Value && ispublic == TriState.False))) ||
(ispublic == TriState.NA && search != "" && risk.IsPublic.HasValue && risk.IsPublic.Value.ToString().IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0)
)
)
select risk).Take((pagesize * (pageindex + 1)) + 1);
However Linq-To-Sharepoint doesn't convert most of this to CAML and the list I'm querying has more than 50000 items. It takes about 4-8 seconds to retrieve the items which is not acceptable.
I've been trying to generate a dynamic query but so far I haven't been able to get it to work.
With AND and OR operations to generate the query I could put all those conditions on code and increase performance.
If someone could help I would be appreciated.
I've scrapped using linq to sharepoint for large lists with complex predicate filters. I've had far better performance using unions and/or merging the data from the splistitemcollection results of an SPQuery results.
It looks as though you are duplicating the work of the sharepoint search engine, have you considered if it is possible to replace with something like the keyword or fulltext query classes?
Also, you should be able to eliminate the need to do duplicate evaluation such as checking for empty string AND indexof. i.e... just simply something like
Risk.IsPublic.Value.ToString().IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1
What is the datatype for IsPublic ? If this is a boolean field you can save yourself some time as well without having to additional conversions.
I am generating a Gridview with Custom controls (Text boxes) as per the user input during the run time. when i try to access the data in those text boxes, its not happening
I had triggered this operations with the Button and the code is as follows:
for (int rowCount = 0; rowCount <= gvCapacity.Rows.Count; rowCount++)
{
for (int i = 1; i < gvCapacity.Columns.Count; i++)
{
if (i > rowCount)
{
if (!(gvCapacity.Columns[i].HeaderText == "Route" && gvCapacity.Columns[i].HeaderText == "Location" && gvCapacity.Columns[i].HeaderText == "RouteLocationID"))
{
TextBox txtBox = gvCapacity.Rows[rowCount].Cells[i].FindControl("txt" + gvCapacity.Columns[i].HeaderText) as TextBox;
}
}
}
It returns the Null value when i try to access the textbox data.
Can anyone help me out on this.
Regards
Geeta
If you mean the texbox variable "txtbox" is always null it looks like that would be because you're asking that the headertext be two different things in your if conditional:
.. && gvCapacity.Columns[i].HeaderText == "Location" && gvCapacity.Columns[i].HeaderText == "RouteLocationID
which it never will be... one assumes. i.e. FindControl is never evaluated. Maybe one of those && should be an ||?