Thanks for your input!
Dhyanga
Thanks for your input!
Dhyanga
I did. The vendor said it is my computer issue. I had someone from IT look into it, who said that there is no known issue.
Dhyanga
I am using a software from our vendor. The software works well in some machines, but get an error "[FireDAC][Phys][IBLite]-314. Cannot load vendor library [ibtogo64.dll]" on other machines. All of these machines have 64 bit Windows 10 Enterprise OS. And the ibtogo64.dll file is present in the same folder where the software exe file is located, in all of the machines. I would really be grateful, if someone could point me to right direction on how to resolve this issue. Thank you.
Dhyanga
I have a datepicker which needs to have its date disabled only on button click. below is the code on button click. I actually wanted to use returned data but for now to check I am only using availableDates for blocking. Please help.
posting.done(function (data) {
var date = new Date();
var temp = data.split(",");
alert(data);
var year = (new Date).getFullYear();
$("#datepicker").datepicker();
var availableDates = ['01-25-2021'];
$("#datepicker").datepicker({
beforeShowDay: function (d) {
var dmy = (d.getMonth() + 1);
if (d.getMonth() < 9)
dmy = "0" + dmy;
dmy += "-";
if (d.getDate() < 10) dmy += "0";
dmy += d.getDate() + "-" + d.getFullYear();
if ($.inArray(dmy, availableDates) != -1) {
return [false];
} else {
return [true];
}
}
});
})
Dhyanga
I am able to fix it. Please disregard this post.
Dhyanga
Hello, I am new in MVC. I have one product table which has ProductID, ProductName and ProductRate. I have one dropdown list which has all the ProductName. Now I am trying to select the productname and upon this select, it should fill my textbox with ProductRate. Code is as below but it is not doing anything and no errors. Please help.
function GetPrice(\_this) {
var x = document.getElementById("productID"), selectedValue = x.value;
alert("\_this" + \_this.SelectedValue);
var pid = selectedValue;
alert(pid);
var url = '@Url.Action("GetPrice","Sales")';
alert(url);
$.ajax({
type:"POST",
url: 'Sales/GetPrice',
contentType: "application/json; charset=utf-8",
data: {ProductId: pid },
cache:false,
dataType: json,
async: true,
processData:false,
success: function (data)
{
alert("yay1");
},
failure: function (response) {
alert("Fail");
}
});
};
@using (Html.BeginForm())
{
@Html.ValidationSummary(true)
@Html.LabelFor(model => model.ProductId)
@Html.DropDownListFor(model => model.ProductId, new SelectList(ViewBag.ProductList, "ProductId", "ProductName" ), "Select Product", new { id = "productID", onchange="GetPrice(this);"})
@Html.ValidationMessageFor(model => model.ProductId, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Rate)
@Html.EditorFor(model => model.Rate, new { id = "idRate"})
@Html.ValidationMessageFor(model => model.Rate)
\
}
Here is my Controller "SalesController.cs" code:
[HttpPost]
public JsonResult GetPrice(int ProductId)
{
return Json("");
}
Dhyanga
Hello , I have a situation where I need to jump to a specific location from tab 1 to tab 2's certain section. Here is the sample of my code.
@{
tab1
click me 1
click me 2
tab2
test1 description
test2 description
test3 description
test4 description
test5 description
test6 description
test7 description
test8 description
test9 description
test10 description
test11 description
test12 description
test13 description
test14 description
}
Now how do i click "Click me 1" and go to the "tabs-2" and scroll down to "test14 description"? Please help. Thank you
Dhyanga
Hi, I have a situation where I need to show data from database to textboxes. These textboxes has to be dynamically created and can be editable. I am able to create textboxes as follows:
string[] myData = liD1.ToArray(); //liD1 is a list that has values from database
public void showData()
{
for (int i = 0; i < myData.Length; i++)
{
if (txtMore.FindControl("txtD1StartTime" + i) == null)
{
txtStart1 = new TextBox();
lblStart1 = new Label();
txtStart1.ID = "txtD1S" + i;
lblStart1.ID = "lblD1S" + i;
txtStart1.Text = myData\[i\].ToString();
lblStart1.AssociatedControlID = txtStart1.ID;
lblStart1.Text = "Data" + i;
txtMore.Controls.Add(lblStart1);
txtMore.Controls.Add(txtStart1);
}
}
}
In my ascx page, I am loading those textboxes in as follows:
showData() function is loading data with dynamically created textboxes. This is working fine. Now If i edit textboxes and try to get new data, it is not giving me anything. Actually it couldn't even find that control. Code is as shown below:
public void getData()
{
for (int i = 0; i < myData.Length; i++)
{
TextBox t = txtMore.FindControl("txtD1S" + i) as TextBox;
if (t != null)
{
string temp = t.Text;
}
}
}
Even though I have dynamically loaded textboxes from showData(), in getData(),it is not able to find any control. Please help.
Dhyanga
Thank you very much Anurag. I don't know why I didn't think of using Ajax before I spent lots of time thinking on this. :)
Dhyanga
Thanks. Yes I did.
Dhyanga
Hi, I am using dynamic datetimepicker that the user can add to any number. But I am having postback problem. Once I submit it, the return page should have all the submitted values including those added dynamic datetimepicker. Right now when i submit and when the page returns, all other static controls with data are there but no dynamically added datetimepicker controls. Below is the code I used to add datatimepicker dynamically using javascript:
<html>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
$(function () {
var counter = 1;
jQuery("#<%= btnD1Add.ClientID %>").click(function (event) {
event.preventDefault(); //this code is added to prevent the default submit functionality of the button
jQuery("* ").appendTo(".Date1More");
jQuery("<label id='lblD1StartTime" + counter + "'>StartTime:</label><input type='text' id='txtD1StartTime" +counter + "' name='txtStartTime1'/>").timepicker({
hourGrid: 10,
minuteGrid: 10,
timeFormat: 'hh:mm tt'
}).appendTo(".Date1More");
counter++;
});
});
</script>
</html>
Now how to use postback for these controls? I had tried to use following code in code but didn't work. I even tried it using !Ispostback() function under pageLoad but no effect.
protected string[] txtStartTime1;
protected void Page_Load(object sender, EventArgs e)
{
txtStartTime1 = Request.Form.GetValues("txtStartTime1");
}
protected void Page_Init(object sender, EventArgs e)
{
Hi, I am using dynamic datetimepicker that the user can add to any number. But I am having postback problem. Once I submit it, the return page should have all the submitted values including those added dynamic datetimepicker. Right now when i submit and when the page returns, all other static controls with data are there but no dynamically added datetimepicker controls. Below is the code I used to add datatimepicker dynamically using javascript:
<html>
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
$(function () {
var counter = 1;
jQuery("#<%= btnD1Add.ClientID %>").click(function (event) {
event.preventDefault(); //this code is added to prevent the default submit functionality of the button
jQuery("* ").appendTo(".Date1More");
jQuery("<label id='lblD1StartTime" + counter + "'>StartTime:</label><input type='text' id='txtD1StartTime" +counter + "' name='txtStartTime1'/>").timepicker({
hourGrid: 10,
minuteGrid: 10,
timeFormat: 'hh:mm tt'
}).appendTo(".Date1More");
counter++;
});
});
</script>
</html>
Now how to use postback for these controls? I had tried to use following code in code but didn't work. I even tried it using !Ispostback() function under pageLoad but no effect.
protected string[] txtStartTime1;
protected void Page_Load(object sender, EventArgs e)
{
txtStartTime1 = Request.Form.GetValues("txtStartTime1");
}
protected void Page_Init(object sender, EventArgs e)
{
I am trying to implement entity framework to that project..
Dhyanga
var query = (from sub in db.myTable
where (sub.Deleted == null || sub.Deleted == 0)
select new
{
sub.ID,
sub.UpdatedByAdmin,
sub.UpdatedBy,
sub.Deleted,
D1 = sub.UpdatedByAdmin.Equals(true ? sub.Date1 : sub.TimesForDate1),
D2 = sub.UpdatedByAdmin.Equals(true ? sub.Date2 : sub.TimesForDate2),
D3 = sub.UpdatedByAdmin.Equals(true ? sub.Date3 : sub.TimesForDate3)
}).ToList();
But this is giving error message as:
System.ArgumentException: DbComparisonExpression requires arguments with comparable types.
I think its because my UpdatedByAdmin, Deleted columns are tinyInt datatype in the database. But When i used these fields in model class, i used byte datatype. I thought byte is equivalent to tinyInt. Please help.
Dhyanga
this is the currently running query in my project. I don't know how columnname with tinyInt datatype be compared to any given value in the case statement in linq.
Dhyanga
string qryInterviews = "SELECT ID, UpdatedByAdmin, UpdatedBy,Deleted " +
"CASE UpdatedByAdmin WHEN 1 THEN Date1 ELSE TimesForDate1 END AS D1, " +
"CASE UpdatedByAdmin WHEN 1 THEN Date2 ELSE TimesForDate2 END AS D2, " +
"CASE UpdatedByAdmin WHEN 1 THEN Date3 ELSE TimesForDate3 END AS D3, " +
"FROM myTable where (Deleted is null OR Deleted = 0)";
In the above query, UpdatedByAdmin,Deleted are of tinyInt datatype. Please help.
Dhyanga
Hidden variable worked well..
Dhyanga
Hi, I have two repeaters Repeater1(parent repeater) and Repeater2 (nested repeater). The Repeater1 has two labels and Repeater 2 as shown.
<HeaderTemplate>
</HeaderTemplate>
<%# DataBinder.Eval(Container.DataItem,"Category").ToString().Trim()%>
<%# DataBinder.Eval(Container.DataItem,"Description").ToString().Trim() %>
<HeaderTemplate >
</HeaderTemplate>
<%# DataBinder.Eval(Container.DataItem,"PriceRanges").ToString().Trim() %>
Now I want to use Category and Description label values as a parameters for the sql query for Repeater2. How do I get those values? Please help. The code I am using is below :
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetCateDescription();
}
}
public void GetCateDescription(string stuID)
{
SqlCommand cmdList = new SqlCommand("Select distinct Category,Description from Records", cnx);
cmdList.CommandType = CommandType.Text;
DataSet ds = new DataSet();
SqlDataAdapter objDA = new SqlDataAdapter(cmdList);
objDA.Fill(ds, "Category");
Repeater1.DataSource = ds;
Repeater1.DataBind();
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (cnx.State == ConnectionState.Closed)
{
cnx.Open();
}
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
Label Category = e.Item.FindControl("Category") as Label;
Repeater Repeater2 = e.Item.FindControl("Repeater2") as Repeater;
Repeater2.DataSource = showAllPrices(Category.Te
Hi, I am new to NHibernate and got issues when running the project. My project name is TestNHibernate, the namespace name is TestNHibernate and the assembly name is TestNHibernate as well. I have a class name Slide.cs as follows:
namespace TestNHibernate
{
public class Slide : IPersistentObject
{
private Guid ID;
private int QuestionID;
private string Questions;
public virtual int QuestionIDD
{
get { return QuestionID; }
set { QuestionID = value; }
}
public virtual Guid GUID
{
get { return ID; }
set { ID = value; }
}
public virtual string Questionss
{
get { return Questions; }
set { Questions = value; }
}
}
public class FacadeSlide : BaseFacade
{
public FacadeSlide() { }
public IList getAll()
{
try
{
return GetQuery().OrderBy(s => s.QuestionIDD).ToList();
}
catch(Exception ex)
{
string s;
s = ex.ToString();
return null;
}
}
}
}
and my Slide.hbm.xml file is as follows:
The hibernate.cfg.xml file is as shown below:
NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.SqlClientDriver
Data Source=myServer;Initial Catalog=Practise;User ID=sa;Password=sa
NHibernate.Dialect.MsSql2005Dialect
thread
true
i removed the htmlform code from the section and now it worked fine.
HttpContext.Current.Response.Clear(); //clear anything in io buffer
Response.ClearContent();
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=GrpFile.xls");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
gvCampGrp.RenderControl(hw);
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
and
public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. */
return;
}
Dhyanga