|
|
i have created two image buttons and i have created positive and negative columns in sql. when i click the positive button,i need to increment the value in positive column in sql
|
|
|
|
|
Message Closed
modified 1-Sep-17 5:08am.
|
|
|
|
|
|
Hi,
I have been given a path of Git source Control folder which has git, hook, info etc folders inside it, I am trying to download the code hence I tried to Clone as suggested in a link, still it is putting .git folder inside my local folder which I have put as Destination and Subdirectory to Create, is there anything I am missing? Do I need to put any new SSH Key etc. I am really worried whom to ask because as there are many ways to download code using git maybe, its so much confusing. Its becoming hard and frustrating.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
<script src="../js/jquery-ui.js"></script>
<link href="../js/jquery-ui.css" rel="stylesheet" />
<input id="txtsearch" type="text" />
$('#txtsearch').autocomplete({
source: '~/CategoryHandler.ashx'
});
public void ProcessRequest(HttpContext context)
{
string name = context.Request["Name"] ?? "";
List<string> ls = new List<string>();
try
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand("CategoryPro", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@action", "ShowCategoryName");
cmd.Parameters.AddWithValue("@serchname", name);
cmd.Parameters.Add("@msg", SqlDbType.VarChar, 500);
cmd.Parameters["@msg"].Direction = ParameterDirection.Output;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
ls.Add(dr["Name"].ToString());
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
}
JavaScriptSerializer js = new JavaScriptSerializer();
context.Response.Write(js.Serialize(ls));
}
|
|
|
|
|
hi
I use asp.net/c# for my application, so I need to preview a report with crystal report but when printing the report I have to delete some labels from the report that means the preview and the printed report are not the same
Can any one help me, please
|
|
|
|
|
Hello Everyone,
I am trying to purchase application security testing tool for my company. Any recommendation? Budget is around $1500. Few tools like
Arachni
netsparker
syhunt
thanks
|
|
|
|
|
I am trying to split fullname into firstname and lastname using the following:
<asp:Label ID="lblPurchOnwer" Text='<%#Eval("buyername") %>' Style="width: 450px;
color: #0093B2; font-weight: bold;" runat="server"></asp:Label>
C#
var Buyernames = Eval("buyername");
var bFName = Buyernames.Substring(0, Buyernames.IndexOf(" "));
var bLName = Buyernames.Substring(Buyernames.IndexOf(" ") + 1);
but I am getting following error message:
'object' does not contain a definition for 'Substring' and no extension method 'Substring' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
Any ideas?
Thank you
|
|
|
|
|
Hi,
don't be lazy, stop using var (unless there is no way around it), use explicit types and your problem will vanish.
|
|
|
|
|
Luc Pattyn wrote: don't be lazy, stop using var (unless there is no way around it), use explicit types and your problem will vanish.
Nothing wrong with using
var at all - I prefer it as it reduces the code noise, but it's really personal choice. It also fits in with most other modern languages too.
[Edit] Weirdly this got downvoted.. anyone care to explain why?
Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Of course it is wrong to abuse var ; if OP had written either string or object the compiler would have made abundantly clear what was wrong with his code and this thread would never have been launched.
|
|
|
|
|
The OP's problem was with mis-using Eval, not declaring variables with var.
Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
No, using Eval with one argument and expecting a string was a mistake,
the problem was he did not understand the compiler's error message which pointed to the following lines, not the line that was in conflict with his intentions, and which was not only late but also not as clear as one might hope, both effects due to the usage of var .
If he had written:
string Buyernames = Eval("buyername");
the compiler would have flagged THAT line, not the following ones, with a clearer message, something like "cannot implicitly convert type 'object' to string"; which everyone understands.
So: remove var , and you'll have no problem fixing the mistake.
|
|
|
|
|
Brent Jenkins wrote: Nothing wrong with using
var There is when you know what the type is.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
SerenityNowDev wrote: There is when you know what the type is.
What's better here then?
System.String myWonderfulString = new System.String();
or..
var myWonderfulString = new System.String();
Or what about your own libraries?
Code.Project.Sample.Library.Helpers.DemoToShowHowDaftThisIs myClassInstance = new Code.Project.Sample.Library.Helpers.DemoToShowHowDaftThisIs();
or..
var myClassInstance = new Code.Project.Sample.Library.Helpers.DemoToShowHowDaftThisIs();
Personally, I really hate typing/reading the same thing twice in the same line. Personally, I really hate typing/reading the same thing twice in the same line.
Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
SerenityNowDev wrote: There is when you know what the type is.
Are you missing a "don't" from that sentence?
var foo = new { Key = 42, Text = "The answer" };
var cache = new Dictionary<Foo, Bar>();
var groupedList = contacts.GroupBy(c => c.Company);
var lookup = (IDictionary<Foo, Bar>)new Dictionary<Foo, Bar>();
var bar = Wibble();
var s = "Hello";
Or were you suggesting that var should only ever be used for anonymous types?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Or were you suggesting that var should only ever be used for anonymous types? I was suggesting not to overuse it, as a previous responder also said.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Eval(expression) returns an object . Try Eval(expression, format) instead, which returns a string.
You'll also need to account for cases where the name doesn't contain a space.
string buyername = Eval("buyername", "{0}");
string bFName, bLName;
int index = buyername.IndexOf(' ');
if (index == -1)
{
bFName = string.Empty;
bLName = buyername;
}
else
{
bFName = buyername.Substring(0, index);
bLName = buyername.Substring(index + 1);
}
Falsehoods Programmers Believe About Names | Kalzumeus Software[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
As usual, perfect solution!
Thank you very much sir.
If I could sir, can please cheat a bit here?
I have similar issue, same code where that same Eval is presenting problem for me.
I have this markup:
bel ID="lblPurchType" Text='<%#Eval("rblPurchaseType") %>' runat="server" />
I am trying to referencing in C# so I can insert records into the database:
Does this look right?
cmd2.Parameters.AddWithValue("@ptype", Eval("rblPurchaseType","rblPurchaseType"));
|
|
|
|
|
No. The format parameter is the same string you'd pass to String.Format[^], with a single placeholder representing the value returned from the data source.
Eval("rblPurchaseType","rblPurchaseType") will literally return the string "rblPurchaseType" , since there is no placeholder in the format parameter.
If you wanted to return the value of the field as a string, you'd need: Eval("rblPurchaseType", "{0}")
But since the AddWithValue method takes an object, you'd be better off using the overload that doesn't convert the value to a string:
cmd2.Parameters.AddWithValue("@ptype", Eval("rblPurchaseType"));
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ahhhh!
I will try with the "{0}"
I had tried the second option before posting here the first time and it did not work.
This:
d2.Parameters.AddWithValue("@ptype", Eval("rblPurchaseType"));
Maybe I did something wrong.
Thanks very much.
UPDATE: Tried both options but still end up with following error message:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
modified 18-Aug-17 15:16pm.
|
|
|
|
|
samflex wrote: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
If you're doing this from the code-behind, you'll need to be in a DataBinding event handler for your data-bound control. Otherwise, ASP.NET has no idea where you want to get the data from.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
please tell me anything new exist to test EF repository instead of Mock lib in .Net Core.
if possible please share some good article links. thanks
|
|
|
|
|
Mou_kol wrote: good article links Google is the place to find them.
|
|
|
|