|
I want to know which button is clicked on datalist item command
i am having three buttons in itemcommand .
how can i get the click event of particular button?
|
|
|
|
|
Hi there,
There are probably a few ways for doing that.
I use a switch:
protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e)
{
switch (e.CommandName)
{
case "Edit":
//do somthing
break;
case "Delete":
//do somthing
break;
}
}
Hope it helps.
Danny
|
|
|
|
|
it worked .
Thanks Danny , keep the good words going on.
|
|
|
|
|
DataListCommandEventArgs e
using e.commandName we can check for button command event.
|
|
|
|
|
Hi danny
Give the Command name to the buttons
and check the Command name in ItemCommand Event like this
if(e.Commandname=="Add")
{
//Do Something here.
}
|
|
|
|
|
Hi All,
is there a way to change WSDL file generated by .NET 2.0 for web services, when i click on "Service Description"? (https://localhost/MyService/MyService.asmx?WSDL)
I want to add a comment to the top of generated WSDL after <?xml version="1.0" encoding="utf-8" ?> and before <wsdl: definitions xmlns: soap="http://schemas.xmlsoap.org/wsdl/soap/" ...
|
|
|
|
|
hi
can u pls help me how to trace the DataGridview's cell click event.
thnks
senthil
|
|
|
|
|
Hi,
Can you please elaborate that exactly what you want to do; because datagridview does have a CellClick Event.
Regards,
Ujjaval Modi
Manpower moves wrenches, horsepower moves cars, and the power of the mind moves the world.
|
|
|
|
|
hi
i have a datagridview contrl which populates a column from table thru dataset.
when i click, or browse through arrow keys , the current cells items should be shown in textboxes for edition.(the selected cell item is key value, i pass it to storedproc and select its other fields to show in textboxes) i had did this through a button click as follows
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
dsGridToTxtBx = obj._selectGridCellAreaDetails(<big>DataGrdVw1.CurrentCell.Value.ToString(</big>));<br />
{<br />
AreaIdValue = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[0].ToString();<br />
<br />
txtAreaName.Text = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[1].ToString();
txtRegion.Text = dsGridToTxtBx.Tables[0].Rows[0].ItemArray[2].ToString();
<br />
}<br />
}
also i tried like this but this doesnt works?
private void DataGrdVw1_CellClick(object sender, DataGridViewCellEventArgs e)<br />
{<br />
string CurrentSelValue;<br />
CurrentSelValue = DataGrdVw1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();<br />
txtAreaName.Text = CurrentSelValue;<br />
}
i would thank if anybody gives me solution
kssk
kssk/div>
|
|
|
|
|
Hi,
Not sure why the following line gives an error mentioned below.
if (dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value = CheckState.Checked)
{
}
Cannot implicitly convert type 'object' to 'bool'. An explicit conversion exists (are you missing a cast?)
Even tried == instead of = but still does not work.
Thanks
|
|
|
|
|
well it definately wont work with one = as thats assignment. With 2 == i'm pretty sure you'll see a different error message saying that there is no implicit conversion to CheckState for the value of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value
try using the debugger to see what the value of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value actually is.
|
|
|
|
|
if (dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value == CheckState.Checked)
{
Operator '==' cannot be applied to operands of type 'object' and 'System.Windows.Forms.CheckState'
|
|
|
|
|
You need to cast the value to a bool before you can test it. Value is an object type, so you need to do this
if (Convert.ToBoolean(dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value) == CheckState.Checked)
|
|
|
|
|
if (Convert.ToBoolean(dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value) == CheckState.Checked)
I doubt CheckState will be able to equate a boolean any better than object would.
|
|
|
|
|
J4amieC wrote: I doubt CheckState will be able to equate a boolean any better than object would.
Ummm - but CheckState.Checked is a boolean. Have I missed some subtlety in the original post?
|
|
|
|
|
Pete O'Hanlon wrote: but CheckState.Checked is a boolean
I dont think so, CheckState[^] is an enumeration.
I might be wrong.
|
|
|
|
|
J4amieC wrote: I might be wrong.
Nope - you're not. Damn, I really need to get more sleep tonight.
|
|
|
|
|
Pete O'Hanlon wrote: Damn, I really need to get more sleep tonight
Yes, you are not yourself today.
|
|
|
|
|
I made the mistake of going food shopping for Christmas late last night and it was insane. So many people, so little food.
|
|
|
|
|
and have you done as suggested and debugged to see what the actual type of dgvSecurityPricing.Rows[e.RowIndex].Cells["AcceptBestPrice"].Value is?
|
|
|
|
|
hi friend,
i have a datagrid. i m serching data with some textbox parameter. i want to edit it.
1. when i edit the cell and check the perticular row checkbox and click on edit button it should save into the database.
Can u guys help me out.
Vinod Kumar Gupta
|
|
|
|
|
SqlCommandBuilder scb = new SqlCommandBuilder(myda);
myda.Update(mydt);
myda is your dataadapter
mydt is your DataTable
|
|
|
|
|
Hi guys,
I have a datagridview. i can delete all rows, bud not the last row, i mean i can't never delete wen there is only one row remaind.
any idea how to fix this?
thanx.
|
|
|
|
|
hi dear,
what u r using to delete in GV. like checkbox or button. could tell me i can do something. if you clear this
thanks
"Good Thing Goes With Good People..."
|
|
|
|
|
Hi PTells,
thanx for your response, i m using a buttom for deleting.
|
|
|
|