|
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:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
<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();
jQuery("<li>").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>
<asp:Button ID="btnD1Add" runat="server" Text="Add more time slots" />
<li>
<ul class="Date1More">
</ul>
</li>
</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)
{
try
{
if (txtStartTime1.Length > 0)
{
TextBox txtStTime1 = new TextBox();
txtStTime1.ID = "txtD1StartTime";
txtStTime1.CssClass = "timepicker";
this.Controls.Add(txtStTime1);
}
}
catch(Exception ex){}
}
Please help..
Dhyanga
modified 4-Dec-14 11:06am.
|
|
|
|
|
|
Thanks. Yes I did.
Dhyanga
|
|
|
|
|
My function takes resource file name as input and returns Bitmap object.
GetManifestResourceNames returns fully qualified resource names. Sample Input is like "Fileopen.png".
How to find the required resource without doing any string operation ? Or any other way is also welcome.
public static Bitmap GetBitmap_FromResource(string ImageName)
{
Assembly assembly = Assembly.GetExecutingAssembly();
string strResName = GetReqdResourceName(assembly, ImageName);
if (string.IsNullOrEmpty(strResName))
return null;
Stream imgstream = assembly.GetManifestResourceStream(strResName);
if (imgstream == null)
return null;
Bitmap Img = new Bitmap(imgstream);
return Img;
}
public static string GetReqdResourceName(Assembly assembly, string strResName)
{
string[] resNames = assembly.GetManifestResourceNames();
return null;
}
|
|
|
|
|
What exactly do you mean by "find the required resource without doing any string operation"? Please explain exactly what problem you are trying to solve.
|
|
|
|
|
Hi! I have a problem with how my program handles an invalid input.
It goes like this:
Enter string: Apple
Enter integer: 1
Enter string: Orange
Enter integer: 2
Search array: Apple
Search found with string name Apple with integer number 1
Search array: Banana
Search found with string name Apple with integer number 1
Object searchValue = null;
string searchString;
do
{
searchString = GetCorrectInput.String(message);
if (!searchString.Equals("Quit"))
{
for (int i = 0; i < objectArray.Length; i++)
{
if (searchString== objectArray[i].studentName)
{
searchValue = objectArray[i];
}
}
if (searchValue == null)
{
Console.WriteLine("{0} was not found", searchString);
}
else
{
Console.WriteLine("Search found string name {0} with integer number {1}", searchValue.stringName, searchValue.integerNumber);
}
}
} while (!searchString.Equals("Quit"));
Console.WriteLine("Thank you!");
Banana is supposed to be not found but its not
|
|
|
|
|
You forgot to set searchValue back to null. The proper place to do that would be at the top of the loop right after searchString is being set.
Regards,
Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
is there a way to avoid using null?
|
|
|
|
|
Member 11284734 wrote: is there a way to avoid using null?
Why would you want to do that?
Please explain in detail!
Your code (if it even is your code which I'm now beginning to seriously doubt) uses the check for null explicitly so that would be the way to go.
You could of course use a special instance of whatever class ( it is not shown in your code sample) to signify that the searchString wasn't found, but that special instance also would have to be assigned to searchValue every time somewhere at the top of the loop before coig through the array comparing searchString against studentName .
Regards,
Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Apart from resetting searchValue variable to null, I think you also should break out if for loop as soon as you found the matching value in array.
|
|
|
|
|
Any answers are appreciated.
Thanks....
|
|
|
|
|
What Operating System?
With Windows (7) I have been using NET USE to create a mapped drive, COPYing to it, and then using NET USE to /delete the mapped drive.
f:\>net use ?
The syntax of this command is:
NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]
|
|
|
|
|
Hi,
I would like to ask why I am getting the following error on the below code please?
The error is: invalid length for a base-64 char array or string
and this is the code:
string server = cipher_utility.Decrypt<RijndaelManaged>(xmlClass.read_registry("Softnames", "ServerHost"), "{1234567-1234-1234-1234-123456789012}", "{12345678-1234-1234-1234-123456789012}");
Thanks,
Jassim
Technology News @ www.JassimRahma.com
|
|
|
|
|
Probably because the encrypted data has not been stored (or encrypted) correctly. And you would find debugging your code much easier if you did not write compound statements. It is just as efficient, and so much easier to debug, and to read, to write it as:
string encryptedData = xmlClass.read_registry("Softnames", "ServerHost");
string server = cipher_utility.Decrypt<RijndaelManaged>(encryptedData, "{1234567-1234-1234-1234-123456789012}", "{12345678-1234-1234-1234-123456789012}");
|
|
|
|
|
so how to go with the fix?
Technology News @ www.JassimRahma.com
|
|
|
|
|
What fix? Your encrypted data is either incomplete or has been corrupted. You need to diagnose the issue to find out how that happened.
|
|
|
|
|
I can't explain it properly in the subject section, it's not as simple as that.
Here is the code snippet in question.
UserPass = reader["Password"].ToString();
So UserPass is my string variable and reader is an SqlReader object.
Here is it being instantiated:
SqlDataReader reader = myCommand.ExecuteReader();
(myCommand is an SqlCommand obj)
reader["Password"]
Password is a column name in my Sql DB. Basically I've just told the reader to go look within that column and used a query to specify where abouts.
I want to set the reader["Password"] equal to an empty string to compare against user input. Now there aren't any errors when I do this but it does throw an exception:
An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code
It doesn't give much more detail other than that and I'm not entirely sure what's wrong.
|
|
|
|
|
Nothing you provided looks obviously wrong. Which statement throws the Exception? We may need to see the query.
And provide the code in proper order.
modified 3-Dec-14 14:47pm.
|
|
|
|
|
did you debug to identify on which line you had the issue?
Mark the answer as accepted if that worked for you .
And for down-voters please specify the reason to improve the solution .
|
|
|
|
|
HI...
I am beginner in WPF and I have a problem with saving data from DataGrid to text file (text file is usedby other program). I check on google, bing and find nothing. Please help.
|
|
|
|
|
I'd suggest you post your code and show where you are stuck.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Member 10024517 wrote: I have a problem You need to explain clearly what that problem is if you want assistance.
|
|
|
|
|
I will paste my code later, but what I want is to save (export) data from data grid to text file. For example we have few columns number|data|description|date|img with few rows. Then I want to save that to text file in format
number///data///description///date//img (one row for one line in text file).
|
|
|
|
|
Could you recommend me a method how to create a hotel room booking calendar like this?
http://www.daypilot.org/tutorial/hotel/[^]
I have two ideas and I tried to create the calendar, but I have problems with it.
1. idea: Create a DataGridView. It is good because there are cells and header cells in it, it is scrollable, but I can't insert controls in the cells (button or panel) which would show the reservations through days (like in the example) because column span is not supported by the datagridview.
2. idea: Use a TableLayoutPanel. It supports column spanning and I can insert any type of Control in its cells, so I can insert controls which shows the interval, name, etc.. of the room reservation and it can overlap many cells. The only problem is that I have to create row headers and column headers. I created another tablelayoutpanel over the table, it would be the column header. The header would horizontally scroll simultaneously with the main table, but if I turn autoscroll on, the scollbar is visible and it is not good. If I turn off autoscroll, I can't scroll the panel from code. It would be good if I could create an independent hscrollbar and in it's scroll event I could set the header and main tablelayoutpanels scroll position simultaneously.
Have you any ideas?
|
|
|
|
|