|
|
Hi All,
in one (windows)form im binding the table to datagridview ,with check box
column . if i click check box in one column , i want to display the
content of that row in a new window ...
in which event we have to write the code .., give me samples or tell me how to write ..!!
thanks .
|
|
|
|
|
Hi,
You can use the CellEndEdit() event for DataGridView. You can probably take a look at the given code.
Lets say we have a grid with first column as boolen column. You have another form2 with a property
GetDataRow() to receive the DataGridView row. In this scenario, you can put the following code under
CellEndEdit() event.
<br />
if (e.ColumnIndex == 0) <br />
{ <br />
<br />
DataRow dr; <br />
<br />
if (DataGridView1(e.ColumnIndex, e.RowIndex).Value == false) <br />
{ <br />
<br />
Form2 frm = new Form2(); <br />
frm.GetDataRow = DataGridView1.Rows[e.RowIndex];
frm.ShowDialog(); <br />
<br />
} <br />
} <br />
I hope this helps.
Regards,
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
thanks ,
i will try this code
regards,
csn.
|
|
|
|
|
Hello friends,
I am developing an windows application setup project using setup wizard.
now what i want to add uninstall feature in setup application.
So how can i add uninstall feature to setup project...
|
|
|
|
|
Add the Following to the beginning of your Applications Main()
<br />
# region For UnInstaller<br />
string[] arguments = Environment.GetCommandLineArgs();<br />
foreach (string argument in arguments)<br />
{<br />
if (argument.Split('=')[0].ToLower() == "/u")<br />
{<br />
string guid = argument.Split('=')[1];<br />
string path = Environment.GetFolderPath(Environment.SpecialFolder.System);<br />
ProcessStartInfo si = new ProcessStartInfo(path + "\\msiexec.exe", "/x " + guid);<br />
Process.Start(si);<br />
Application.Exit();<br />
Environment.Exit(0);<br />
}<br />
}<br />
# endregion<br />
Go to the Installer project and add a shortcut to the Primary output and rename it to
Uninstall <Application Name>
Go to the Properties of the newly added shortcut and Set the Arguments property to
"/u=[ProductCode]"
Place the shortcut in the user's programs menu.
Create a build and your application is ready with Uninstaller.
thanks
kss
|
|
|
|
|
hi friends....
i am used one single line textbox for getting values.. When the enter button press the single line textbox is changed to
multi line textbox and also create one new line... but the cursor always gets back to right upper corner of the textbox instead of staying in the new line position...How can i set cursor position to new line....
|
|
|
|
|
Aravinthan wrote: When the enter button press the single line textbox is changed to
multi line textbox
No, it's not. The user hitting enter does not change the behavior of the TextBox. Are you sure you didn't set the MultiLine property of the TextBox to true, and then in the design make it LOOK like it's only one line high??
|
|
|
|
|
i set the MultiLine property of the TextBox to true at the time of key(Enter key) down and i create one new line txtbox1.Text+Environment.NewLine.....but the cursor is in upper left corner of the textbox...
|
|
|
|
|
Aravinthan wrote: i set the MultiLine property of the TextBox to true at the time of key(Enter key) down
OK. I fail to see how this is useful. Why would you do something like this?
Did you also set the TextBox's AcceptsEnter property to true?? Did you look into the TextBox's SelectionStart property? This sets the position of the insertion point (blinking cursor).
|
|
|
|
|
Hello,
I'm trying to execute the following mechanism ..
>>>>> get records from the DB , ( e.g. record for each product )
>>>>> create a "link label" for each record ( product )
>>>>> when any of the link labels is clicked .. it assign the ProductID value from the record to a Global variable named ProductID
>>>>> add all the link lables to a panel
that's what've done, My problem is that i always get the value of the last record
<br />
DataTable dtUserOffers = ProductsQuery;<br />
<br />
int NewY = 0;<br />
<br />
for ( i = 0; i < dtUserOffers.Rows.Count; i++)<br />
{<br />
<br />
LinkLabel lnkUserOffers = new LinkLabel();<br />
<br />
<br />
lnkUserOffers.AutoSize = true;<br />
lnkUserOffers.Location = new System.Drawing.Point(18, NewY);<br />
lnkUserOffers.Name = "lnkUserOffers" + i.ToString();<br />
lnkUserOffers.Size = new System.Drawing.Size(59, 14);<br />
lnkUserOffers.TabStop = true;<br />
lnkUserOffers.Text = "View";<br />
<br />
<br />
Global.Product_id = int.Parse(dtUserOffers.Rows[i]["ProductID"].ToString());<br />
<br />
EventHandler handler = new EventHandler(LinkLabel_Click);<br />
<br />
lnkUserOffers.Click += handler;<br />
<br />
NewY += 15;<br />
<br />
panel1.Controls.Add(lnkUserOffers);<br />
<br />
}<br />
<br />
<br />
private void LinkLabel_Click(object sender, EventArgs e)<br />
{<br />
<br />
MessageBox.Show(Global.ProductID);<br />
<br />
}
How can i Handle this an assign a specific action to each created link label
|
|
|
|
|
you may use anonumous methods and closure .
// you can use method with no name this is delegate (args ){} aka anonymous methodes
EventHandler handler = new EventHandler (new delegate (object sender,EventArgs e){
MessageBox.Show(Global.ProductID); // you can use variables global that is closure
}))
or you can use command objects this is objects that actually encapsulate a method
ec
ClickCommand command = new ClickCommand(product_id)
EventHandler handler = new EventHandler (command.ExecuteOnClickAction);
where
class Clickcommand
{
int productid;
public void ExecuteOnClickAction()
{
MessageBox.Show(productID);
}
}
or many more improvise
f(yf) = yf
|
|
|
|
|
hi all
in my application iam having a grid which contains a check box at the top and name field inside and check boxes to select the particular name.(like in mail boxes).i can select the particular checkbox if i want..till here no problem..but if i want to select all the check boxes by clicking the check box at the top(note this has to be done by clicking the check box and not by any buttons like unread button as in gmail or yahoo).can anyone give me code to do it...
thanks in advance..
pintoo
|
|
|
|
|
|
hi i have tried this link...it is not working ..iam giving the code herewith.do tell me what iam missing..
ASPX PAGE
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
<script language="javascript" type="text/javascript"><br />
function SelectAll(idHeaderCheckbox)<br />
{ <br />
var checkboxHeader = document.getElementById(idHeaderCheckbox);<br />
var hdnCheckboxIDs = document.getElementById("hdnCheckboxID") ;<br />
var arrCheckboxIDs = hdnCheckboxIDs.value.split(",");<br />
<br />
if(checkboxHeader.checked == true)<br />
{<br />
for(var i=0 ; i < arrCheckboxIDs.length ; i++ )<br />
{<br />
if(arrCheckboxIDs[i] != "")<br />
{<br />
var ckbItem = document.getElementById(arrCheckboxIDs[i]);<br />
ckbItem.checked = true;<br />
}<br />
}<br />
}<br />
else if(checkboxHeader.checked == false)<br />
{<br />
for(var i=0 ; i < arrCheckboxIDs.length ; i++ )<br />
{<br />
if(arrCheckboxIDs[i] != "")<br />
{<br />
var ckbItem = document.getElementById(arrCheckboxIDs[i]);<br />
ckbItem.checked = false;<br />
}<br />
}<br />
}<br />
}<br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound"><br />
<Columns><br />
<asp:TemplateField><br />
<HeaderTemplate><br />
<asp:CheckBox ID="ckbHeader" runat="server" /><br /><br />
</HeaderTemplate><br />
<ItemTemplate><br />
<asp:CheckBox ID="ckbItem" runat="server" /><br /><br />
</ItemTemplate><br />
</asp:TemplateField><br />
<asp:BoundField DataField="Name" HeaderText="Emp Name" /><br />
<asp:BoundField DataField="EmpID" HeaderText="Emp Id" /><br />
<asp:BoundField DataField="Age" HeaderText="Emp Age" /><br />
</Columns><br />
</asp:GridView><br />
<input type="hidden" id="hdnCheckboxID" runat="server" /><br />
</div><br />
</form><br />
</body><br />
</html>
code behind file..
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}
private void BindGrid()
{
string Connstr = "connection string"
SqlConnection Conn = new SqlConnection(Connstr);
string str = "select * from employee";
SqlCommand cmd = new SqlCommand(str,Conn);
Conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter Adap = new SqlDataAdapter();
Adap.SelectCommand = cmd;
Adap.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
CheckBox ckbHeader = e.Row.Cells[0].FindControl("ckbHeader") as CheckBox;
ckbHeader.Attributes.Add("onclick", "SelectAll(" + ckbHeader.ClientID.ToString() + ")");
}
else if(e.Row.RowType==DataControlRowType.DataRow)
{
CheckBox ckbItem = new CheckBox();
ckbItem = e.Row.Cells[0].FindControl("ckbItem") as CheckBox;
hdnCheckboxID.Value += ckbItem.ClientID + ",";
}
}
pintoo
|
|
|
|
|
Hi,
Just make the following two changes and it will work.
update this line
ckbHeader.Attributes.Add("onclick", "SelectAll(" + ckbHeader.ClientID.ToString() + ")");
to
ckbHeader.Attributes.Add("onclick", "SelectAll(this)");
and update this javascript line
var checkboxHeader = document.getElementById(idHeaderCheckbox);
to
var checkboxHeader = idHeaderCheckbox;
Do let me know if u need more info,
Cheers...
|
|
|
|
|
hi vimal raj
it is working perfectly..thanx for your valuable suggestion and your time.
pintoo
|
|
|
|
|
i want to make a remote backup server. plz send me c# example related to remote backup server.
regards
modified on Tuesday, March 25, 2008 11:43 AM
|
|
|
|
|
|
Hello everyone,
I do not understand what means "A stateless design (popular for reasons of scalability) intrinsically limits the possibility of interaction, since classes are unable to persist data between each request." and why such design will be better to scale. Any more descriptions?
http://www.albahari.com/threading/part2.html
--------------------
Another way to cheat is to minimize thread interaction by minimizing shared data. This is an excellent approach and is used implicitly in "stateless" middle-tier application and web page servers. Since multiple client requests can arrive simultaneously, each request comes in on its own thread (by virtue of the ASP.NET, Web Services or Remoting architectures), and this means the methods they call must be thread-safe. A stateless design (popular for reasons of scalability) intrinsically limits the possibility of interaction, since classes are unable to persist data between each request. Thread interaction is then limited just to static fields one may choose to create – perhaps for the purposes of caching commonly used data in memory – and in providing infrastructure services such as authentication and auditing.
--------------------
thanks in advance,
George
|
|
|
|
|
George_George wrote: A stateless design (popular for reasons of scalability) intrinsically limits the possibility of interaction, since classes are unable to persist data between each request
Yes as told in the article, this is another way to minimize thread interaction. Webservers communicates with the clients through HTTP protocol. When a request arrives at the webserver, it processes and sends the response back. It's not persisting the data(HTTP is stateless) . Instances will be created and disposed before sending the response, also each request has it's own thread. This limits the interaction between threads. But static classes will be there in the memory for long time, so thread interaction is needed there.
Hope it's clear
|
|
|
|
|
Thanks N a v a n e e t h,
Your reply is clear. Question answered.
regards,
George
|
|
|
|
|
Glad to know it helped
|
|
|
|
|
George_George wrote: This is an excellent approach and is used implicitly in "stateless" middle-tier application and web page servers.
Not sure I believe that is completely accurate. There seems to be a mixing of several things into one and making a point that is not valid for all of them. HTTP is a stateless protocol. That has nothing to do with threading. And in fact modern Application Servers do provide mechanisms to manage state in an HTTP context. While the point about static data is accurate it's mixed in a discussion of Application Servers which don't use static data to provide state mechanisms.
Perhaps I am reading it wrong but I find that paragraph confusing and I'm not at all sure that it is accurate.
led mike
|
|
|
|
|
Hi led mike,
Which point or points do you think is inaccurate? HTTP is stateless (almost), but still use minimal static data which needs to be synchronized by threads, I think this is both the points from my quoted article and your points.
regards,
George
|
|
|
|