|
i can't understand your question clearly but i think your anwser is :
you must first set Autopostback property of the checkbox to the true and then work with
checkedchanged event like this code:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (CheckBox1.Checked)
Response.Write("checked");
else
Response.Write("unchecked");
}
|
|
|
|
|
Thanks for the time and reply maryamf.
The problem with this is that I cant have it postback when the user clicks the checkbox. All validation will happen when the client clicks the 'continue' button. I had it working perfectly with the autopostback, however they thought it was distracting having it refresh on each click. And I agree if there are on dialup or something.
So my question was mainly in the validation of the page, via the continue button. I have to Iterate through the controls and find the checked one. However, this needs to be done without postback when user clicks checkboxs. Anyway to get the values of the controls this way?
Hope that made sense.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
Javascript, and go ask in the ASP.NET forum
|
|
|
|
|
thanks for the reply leppie, unfortunatly javascript wont do it either. This needs to be server side because the values I get from the id of the checked checkbox will be used to gather the data on the next page.
I guess to ask it a different way: Can I get the correct value of a checkbox without posting back? What needs to change in the code above in order for this to happen? I can't set the AutoPostBack to true because of the refresh. This event I created takes the refresh away but now I cannot grab the value with the current code.
Come to think of it, I might just forget about doing it the event way and just do all validation in the Continue buttons click event...not sure what client would say but I know it works.
Thanks again leppie for the time.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
hi ,
When I click on my textbox , the cursor always appear at the top of textbox.
i dont want the cursor appear
How can I disable the cursor?
|
|
|
|
|
Disable the textbox.
---
b { font-weight: normal; }
|
|
|
|
|
sorry i didnt understand ,
in my textbox , i draw square using pen class at the top of textbox and later when i click to the textbox , cursor appear so square is damaged
how can i correct this
|
|
|
|
|
If you want a textbox without a cursor, you have to make it non-editable. That you do by disabling the textbox.
If you want to draw on top of a control, you have to do that in the paint event, or whatever you draw will be drawn over whenever the control is updated.
---
b { font-weight: normal; }
|
|
|
|
|
Hey again :P
So I have a XML with DataSet in it, in the DataSet I have 2 DataTables, in each DataTable I have a Uniqe ID, and I did to this row, auto-inc, and don't allow DBNull.
So when I try to do NewRow(), and add it without setting the ID column, it throws an Exception DataColumn 'ID' can't allow DBNull.
So how can I do it as UNIQE ID? do I need to allow DBNull?
|
|
|
|
|
Hi,
i am using tableadapters to insert into 2 different tables the insert methods are in transaction. The first insert must return a value for the second insert. both inserts works just fine if the execution mode of the first tableadapter is nonquery(it doesn't return the @@IDENTITY I need) and if i remove the neccessary forein key in the second table but when i change it to scalar(to get the @@IDENTITY neccessary) it returns the following error. "ExecuteScalar requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized.". can anyone please help.
|
|
|
|
|
Hello.
I can't find a control to check a Regular Expression that I want... so I could check a TextBox.
How can I do it? (or what is the Control for that)
|
|
|
|
|
The control is the RegularExpressionValidator control.
---
b { font-weight: normal; }
|
|
|
|
|
I couldn't find it in the toolbox so I searched it in the "choose items".
When I did OK, it didn't show it in the toolbox, and then I did "Show all items", so it shows it, but I can't drag it or do something with it, it looks like it's disabled...
Maybe you know what can I do?
|
|
|
|
|
Just to make sure: Is it a web application you are working with?
---
b { font-weight: normal; }
|
|
|
|
|
No, it's a win application, that's why I'm posting here and not in ASP.NET forum.
but the other guy helped me.
|
|
|
|
|
That explains it. There is no built-in validation controls for windows forms.
---
b { font-weight: normal; }
|
|
|
|
|
|
Hello,
I've got a table orders with 3 fields:
- date
- productid
- amount
productid & amount are values seperated by commas, f.e.: productid = 1,2 amount = 3,4 (which means there are 3 products "1" and 4 products "2").
Now, I want to select a field by date and get the value of productid & amount and put them in an array (or arraylist?).
Than, I want to fill a datagridview with again 2 colums (amount & productid) with that data.
So for the example the datagridview should look like:
3 1
4 2
This is what I wrote:
<br />
bill.Rows.Clear();<br />
SqlCommand myCommand = new SqlCommand("SELECT * FROM orders WHERE date = @date", connect);<br />
myCommand.Parameters.AddWithValue("@date", DateTime.Parse(listOrders.Text.ToString().Substring(0, 19)));<br />
SqlDataReader myReader = myCommand.ExecuteReader();<br />
while (myReader.Read())<br />
{<br />
amounts = myReader["amount"].ToString();<br />
products = myReader["productid"].ToString();<br />
}<br />
myReader.Close();<br />
<br />
string[] product = new string[products.Split(' ').Length];<br />
string[] amount = new string[amounts.Split(' ').Length];<br />
<br />
product = products.Split(' ');<br />
amount = amounts.Split(' ');<br />
<br />
for (int i = 0; i <= product.Length; i++)<br />
{<br />
bill.Rows.Add(amount[i], product[i], 1, 2);<br />
}<br />
But I always get an error near the product = products.Split ..
System.NullReferenceException was unhandled<br />
Message="Object reference not set to an instance of an object."
I don't really think the code is 100% ok, but can somebody help?
Thanks!
|
|
|
|
|
JelleM wrote: I don't really think the code is 100% ok, but can somebody help?
I've annotated your code with what it is doing.
bill.Rows.Clear();
SqlCommand myCommand = new SqlCommand("SELECT * FROM orders WHERE date = @date", connect);
myCommand.Parameters.AddWithValue("@date", DateTime.Parse(listOrders.Text.ToString().Substring(0, 19)));
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
amounts = myReader["amount"].ToString();
products = myReader["productid"].ToString();
}
myReader.Close();
string[] product = new string[products.Split(' ').Length];
string[] amount = new string[amounts.Split(' ').Length];
product = products.Split(' ');
amount = amounts.Split(' ');
for (int i = 0; i <= product.Length; i++)
{
bill.Rows.Add(amount[i], product[i], 1, 2);
}
Does this help you see what your code is doing?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Yes, thank you!
|
|
|
|
|
I have problem with the data.
From my main window I click other form is opened and I want to type in some data like alarm time, but I have problem with display it in my main window.
I want display it in my label but i don't how to get to that label,and other variables in my main window from my second form??
-- modified at 9:55 Saturday 27th May, 2006
examle I have somethin like this
public partial class Form1 : Form
{
public int a, b, c;
public Form1()
{
InitializeComponent();
}
and I want to acces the a,b,c prameters from my form2.
|
|
|
|
|
Ok so what you would do is hand these variables to the constructor of your second form:
Ex.
public partial class Form2 : Form
{
public int d, e, f;
public Form2(int a, int b, int c)
{
d = a;
e = b;
f = c;
InitializeComponent();
}
...
public partial class Form1 : Form
{
public int a, b, c;
public Form1()
{
InitializeComponent();
}
something_OnClick()
{
Form2 frm2 = new Form2(a, b, c);
frm2.ShowDialog();
}
|
|
|
|
|
Maybe it's works, but I still don't know how to do this.
|
|
|
|
|
What dont you understand?
|
|
|
|
|
I don't know how it works.
Itried to do it as you wrote, but it doesn't work.
mariuszfryta
|
|
|
|