|
AJAX is one solution ... But, i am using WPF in my project...
Aslesh
|
|
|
|
|
I assume you mean you're using Silverlight ? Or is this not even a web app ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
OK - well, you wasted a lot of your own time by asking in the ASP.NET forum then. The answer is then trivial - set a timer when the user presses a key. And, next time, ask in the right forum.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thanks for your reply.. and as this is my first post i am not familiar what is the correct palce to post this.
If you know the syntax for the timer that will be a gr8 help for me
Aslesh
|
|
|
|
|
You did post it in the right place, you just posted it here first.
I use the System.Windows.Forms.Timer even in WPF b/c I am used to it.
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); // this is a member
// This goes in the keypress.
t.Inverval = 1000; // one second
t.Tick += delegate {
// Wahtever code you want here
};
t.Start();
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian,
I tried with the syntax you have given. but the thing is for the first time its taking the time interval correct ( here i gave it as 5 sec).but, when i agian changing the text then its holding for only 2.5 sec and then if i do it for 4 to 5 times its displaying instantly.
do you have any idea about this situation?
Aslesh
|
|
|
|
|
RTFM. You probably need to Stop() the timer before you start it again or something like that.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
aslesh wrote: If you know the syntax for the timer that will be a gr8 help for me
aslesh wrote: I tried with the syntax you have given. but the thing is for the first time its taking the time interval correct ( here i gave it as 5 sec).but, when i agian changing the text then its holding for only 2.5 sec and then if i do it for 4 to 5 times its displaying instantly.
Maybe you should just go to his location and do the work for him I bet that would be a gr8 help for him.
led mike
|
|
|
|
|
I am new to .net programming, so please pardon any mistakes I make. On my page have gridview1 and inside the edit template of the gridview1 have texbox8. When the user clicks on the edit button the textox8 should automatically populate current machine date. I am not sure how to access the texbox8 inside the gridview and display the current date.
Following is the part of the code:
<asp:gridview id="GridView1" runat="server" allowpaging="True" xmlns:asp="#unknown">
AllowSorting="True" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource1" Height="369px" Width="482px"
Font-Names="Arial" Font-Size="8pt" ForeColor="#333333" GridLines="None"
PageSize="30"
<edititemtemplate>
<asp:textbox id="TextBox4" runat="server" height="15px">
Text='<%# Bind("ClosedDate", "{0}") %>' Width="60px"
ontextchanged="TextBox4_TextChanged">
<cc1:calendarextender id="TextBox4_CalendarExtender" runat="server" xmlns:cc1="#unknown">
Enabled="True" TargetControlID="TextBox4">
/GridView1>
Here is the code in my .vb file:
Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
For Each row In GVOpenNCMR.Rows
Dim textBoxText As = (CType(row.FindControl("TextBox4"), TextBox)).Text
Next
End Sub
Not sure where to put the code for the textbox to populate system date. Anyhelp would be appreciated. Thanks.
|
|
|
|
|
If you're new to .NET, why are you working on something so complex ? And why is your textbox called textbox8 ?
RuhrT wrote: For Each row In GVOpenNCMR.Rows
Dim textBoxText As = (CType(row.FindControl("TextBox4"), TextBox)).Text
Next
This is a mess. You don't need to do this, sender is TextBox4, you just need to cast it. But, either way, what are you trying to do here ? And why send a postback every time the text is changed ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I am trying to populate the textbox with today's date as soon as the user clicks on the edit button of the gridview. I have to find that control in the gridview first and that's what below code is doing.
Dim textBoxText As = (CType(row.FindControl("TextBox4"), TextBox)).Text //Looking for the textbox inside the gridview.
|
|
|
|
|
But it does it in the text changed event. why do you want to replace the text they just entered ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
*sigh* another person who asks questions and runs away when people try to help....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I can't help you if you don't respond.....
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hello,
I have this CheckBoxList that is connected to a database table. If an item is selected - the values in the table are deleted, then re-inserted with new values, depending on the current selections. However, It works if I make a new selection. If I deselect an existing selection - it refuses to deselect it. So, apparently, the problem is with selecting/deselecting.
If I'd use CheckBoxes instead of the list, it would work fine
Here are some of my code:
<br />
for (n = 0; n < cblRole.Items.Count; n++)<br />
{<br />
if (cblRole.Items[n].Selected)<br />
arr[n] = 1;<br />
}<br />
So, before doing the above, first I need to identify which listitem was clicked - because, the sender is the CheckBoxList itself, not the items.
Thanks.
|
|
|
|
|
There's no SelectedItem property ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Yes, I tried SelectedIndex property...but its doing the same thing.
May be I'm missing something or trying the wrong way. I tried this:
<br />
for (n = 0; n < cblRole.Items.Count; n++)<br />
{<br />
if (n == cblRole.SelectedIndex)<br />
arr[n] = 1;<br />
else<br />
arr[n] = 0;<br />
}<br />
|
|
|
|
|
Gosh - why not just set the selected index to 1 ? What happens when you debug it ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Sorry, may be I was not able to explain to you clearly.
I'm not clear why you said to set SlectedIndex to 1. What do I achieve by doing that?
These are a group of checkboxes and by using the loop, I wanted to identify the ones selected by storing 1 in the array, that I intended to use later.
Anyway, my problem is with selection/deselection. when a checkbox is clicked, how do I know it is selected or deselected (because I can't use the sender).
Thanks.
|
|
|
|
|
The CheckBoxList control returns only the first SelectedIndex. And since it is not an Array you must
check all Items.
foreach (ListItem item in cblRole.Items)
{
if (item.Checked)
{
}
}
|
|
|
|
|
Thanks digimanus and Christian.
I definitely tried this. What's happening is - the checkboxes are checked depending on values in a database table. When they make a new selection, it's suppossed to save the change in the database - then reflect the change in the checkboxes. My code works one way. If they make a new selection, it shows the checkbox as selected. If they deselect one, it doesn't work. It keeps the box as selected. So, I was thinking - it's a problem with the selection/desection.
But now feels like It's something else.
I'll review my code and come back.
Thanks again.
|
|
|
|
|
I have a CustomValidator control which is declared like this:
<br />
<asp:CustomValidator ID="m_DelayCodeValidator" runat="server"<br />
ControlToValidate="m_DelayCode" Text="*" ErrorMessage="Delay code"<br />
EnableClientScript="true"<br />
ClientValidationFunction="m_DelayCode_Validate" <br />
OnServerValidate="m_DelayCode_Validate" /><br />
I have a ValidationSummary control on the page as well. But when I try and submit the form the error message from my custom validator isn't listed with the other error messages in the ValidationSummary. The custom validation script isn't being called either - the script is only called when the value of ControlToValidate changes. I need the script called on submit as well like the other validators are.
ValidationSummary:
<asp:ValidationSummary ID="validationSummary" runat="server" DisplayMode="BulletList"<br />
HeaderText="Please enter the required values:" /><br />
ClientValidationFunction:
function m_DelayCode_Validate(sender, args)<br />
{<br />
if(m_DowntimeCode.options[m_DowntimeCode.selectedIndex].text != "Opportunity Maintenance")<br />
{<br />
args.IsValid = true;<br />
return;<br />
}<br />
<br />
if(args.Value == "" || args.Value == null || args.Value == undefined)<br />
args.IsValid = false;<br />
else<br />
args.IsValid = true;<br />
}<br />
|
|
|
|
|
I found the best thing is to dig in to the js that ASP.NET generates, and to write my own method that duplicates their calls but adds my own, if I want that degree of control.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Thanks for your suggestion. It led me to find a property I hadn't noticed as part of the CustomValidator control - ValidateEmptyText. Setting it to true fixes the problem for me. I guess I neglected to mention that the value of the default option was an empty string. I appreciate the help.
|
|
|
|