[Solved] Check at least one checkboxlist item is selected in Javascript

Refer the link Validating checkboxList Asp.Net control using javascript for details. Please try: <script language=”javascript” type=”text/javascript”> function CheckItem(sender, args){ var chkControlId = ‘<%=chkMealPeriod.ClientID%> ‘ var options = document.getElementById(chkControlId).getElementsByTagName(‘input’); var ischecked=false; args.IsValid =false; for(i=0;i<options.length;i++) { var opt = options[i]; if(opt.type==”checkbox”) { if(opt.checked) { ischecked= true; args.IsValid = true; } } } } 1 solved Check at … Read more

[Solved] LINQ with List

You want to use Any for that since l_obja is not a list of the ids. List<ClassA> l_obja = Obj1.exp.Values.Where(i => i.Id == mid).ToList(); List<ClassB> l_objb = Obj1.Pol.Values.Where(i => l_obja.Any(a => a.MGId == i.GId)); solved LINQ with List

[Solved] Validate username as the user types with jQuery and ASP.NET [closed]

Try this: $(“input[type=textbox]”).keydown(function(){ if(/^[a-zA-Z0-9- ]*$/.test($(this).val()) == false) { alert(‘Your search string contains illegal characters.’); } if(/\s/g.test($(this).val()) { alert(“has white-space”); } if(!$(this).val().length >= 8 && !$(this).val().length <= 25) { alert(“out of range”); } }); For the fourth one you need to do it yourself because I don’t have access to your field names etc. 0 solved … Read more

[Solved] There are more columns in the INSERT statement than values specified in the VALUES clause [closed]

Your problem is that you are attempting to insert 3 values: values(‘{0}’,'{1}’,N'{2}’) Into 4 columns: (nokar,modeledokht,tozihat,username) I believe you meant to do this: values(‘{0}’,'{1}’,N'{2}’,'{3}’) Side note: Always use Command.Parameters instead of parsing your command as string! When parsing the command as a string, you are subjected to SQL injections and errors like the one you … Read more

[Solved] Retrieving a portion of a url

If your URL looks like an actual URL (with the http:// part) then you could use Uri class: private static void Extract() { Uri uri = new Uri(“http://somesite/somepage/johndoe21911”); string last = uri.Segments.LastOrDefault(); string numOnly = Regex.Replace(last, “[^0-9 _]”, string.Empty); Console.WriteLine(last); Console.WriteLine(numOnly); } If it’s exactly like in your example (without the http:// part) then you … Read more

[Solved] how can we sort the list items in drop down list in asp.net programatically [closed]

First take a DataTable to put the data of The Dataset DataTable table = dataSet.Tables[0]; and then you can create a DataView of your Datatable and then bind the drop down list to that. Your code will be like this then DataView dvlist = new DataView(table); dvlist.Sort = “Description”; ddllist.DataSource = dvlist; ddllist.DataTextField = “Description”; … Read more

[Solved] Stored procedure takes too much time in if statement when i pass @ip=” and takes 0 sec with some value to @IP

As I wrote in the comment the answer of your first question is: If I understand your PRC well, in case of @IP = ” it should returns a wieder set of members. I think it is possible that the Username, Email or Country is longer in the member table then the @Temp table’s definition. … Read more