[Solved] Change div visibility when radio button becomes selected [closed]

You need ClientID in javascript not the server id as asp.net will generate the new CliendID for server controls and the selector you have wont find element by that id. $(“#<%= RdbToday.ClientID %>”).change(function () { $(“#dateSelectorSpan”).hide(); }); $(“#<%= RdbDateRange.ClientID %>”).change(function () { $(“#dateSelectorSpan”).show(); }); Edit The code you have is working. Live Demo $(“#RdbToday”).change(function () … Read more

[Solved] How to get control values and modify them in Page Methods?

Quick example: <asp:ScriptManager runat=”server” EnablePageMethods=”true” /> <!– or ToolkitScriptManager, but remember to put only one –> <script type=”text/javascript”> function invokeMethod() { x = document.getElementById(‘<%= TextBox1.ClientID %>’).value; PageMethods.theMethod(x, OnSuccess, OnFailure); } function OnSuccess(r) { document.getElementById(‘<%= TextBox1.ClientID %>’).value = r; } function OnFailure(r) { alert(r._message); } </script> [System.Web.Services.WebMethod()] public static string theMethod(string x) { return x + … Read more

[Solved] Convert string Time format to Time format [closed]

You can try ParseExact method to convert a custom string to a DateTime, then use ToString method to convert it to your desired string format. var result = DateTime.ParseExact(“10:30AM”, “hh:mmtt”, CultureInfo.InvariantCulture) .ToString(“hh:mm:ss tt”); //result : “10:30:00 AM” In the DateTime formatting you may remember these notes: hh: hour part mm: minute part ss: second part … Read more

[Solved] Asp.net dynamic User and activity based authorisation mixed with hide show site master html

You should switch from role based authentication to claims based authentication. Here’s an article describing the basics of claims based authentication: http://dotnetcodr.com/2013/02/11/introduction-to-claims-based-security-in-net4-5-with-c-part-1/ Claims will give you fine grained control over the rights for each individual user. ClaimsPrincipal can also be used in webforms: https://visualstudiomagazine.com/articles/2013/09/01/going-beyond-usernames-and-roles.aspx An attribute can be applied to pages and methods in an … Read more

[Solved] How do I run this code

That code won´t run without visual studio since it have code that must be run on the server. The only thing you can do is copy the code between HTML tag and save it to an HTML file. That will run but since you have logic on your server side your upper case wont work. … Read more

[Solved] to get folders from directory between the dates entered in two textboxes

If you want to filter the files you are gonna iterate through, you can use System.IO‘s FileInfo class instead if File. Then you filter the files by their CreationDate property: DateTime yourstartDate = new DateTime(); DateTime yourEndDate = new DateTime(); DirectoryInfo di = new DirectoryInfo(“any_directory”); List<FileInfo> fis = di.GetFiles().Where(x => x.CreationTime >= yourstartDate && x.CreationTime … Read more

[Solved] add only one property from each item to listbox [closed]

Your attempt at @SLaks suggestion was close, but you can’t add the list of users to the listbox in that manner. This should get you closer: protected void Button1_Click(object sender, EventArgs e) { users.Add(new User { connectionid = TextBox1.Text, nick = TextBox2.Text }); foreach (User u in users) { lbUsers.Items.Add(new ListItem(u.nick, u.connectionid)); } } To … Read more

[Solved] how do I resolve ‘not all code paths return data’?

Since you are not returning a DataSet, set your method return to void private void getData(HiddenField sDate, HiddenField eDate) // < — return void { jQueryUICalendar1.Text = sDate.Value; jQueryUICalendar2.Text = eDate.Value; } Either that, or just return a DataSet private DataSet getData(HiddenField sDate, HiddenField eDate) { jQueryUICalendar1.Text = sDate.Value; jQueryUICalendar2.Text = eDate.Value; DataSet myReturn = … Read more