Click here to Skip to main content
15,900,907 members
Home / Discussions / C#
   

C#

 
QuestionNested DataGrid Pin
Muammar©8-Jun-07 20:51
Muammar©8-Jun-07 20:51 
AnswerRe: Nested DataGrid Pin
danish_ara11-Jun-07 0:56
danish_ara11-Jun-07 0:56 
Questionxml datagrid Pin
Mohammad Daba'an8-Jun-07 20:47
Mohammad Daba'an8-Jun-07 20:47 
AnswerRe: xml datagrid Pin
M. J. Jaya Chitra8-Jun-07 22:42
M. J. Jaya Chitra8-Jun-07 22:42 
GeneralRe: xml datagrid [modified] Pin
Mohammad Daba'an9-Jun-07 0:16
Mohammad Daba'an9-Jun-07 0:16 
GeneralRe: xml datagrid Pin
M. J. Jaya Chitra10-Jun-07 16:53
M. J. Jaya Chitra10-Jun-07 16:53 
GeneralRe: xml datagrid Pin
Mohammad Daba'an10-Jun-07 21:24
Mohammad Daba'an10-Jun-07 21:24 
GeneralRe: xml datagrid [modified] Pin
M. J. Jaya Chitra10-Jun-07 23:05
M. J. Jaya Chitra10-Jun-07 23:05 
In .net 2005
This is a windows application

I have adapted the following code in order to populate the datagridview from xml file
DataSet ds = new DataSet();<br />
            ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
            dataGridView1.DataSource = ds.Tables[0];


While the datagrid is clicked then it mead=ns the user is tring to edit the record so that i can get the selected row and the selected rows first cell contains the primary key so i am passing that to the form 2 (edit form) as follows in that the constructor of the form 2 takes one string argument which is the primary key of the selected field passed from the form1 as follwos

In form 1
private void dataGridView1_DoubleClick(object sender, EventArgs e)<br />
        {<br />
            MessageBox.Show("" + dataGridView1.CurrentCellAddress.Y);<br />
            MessageBox.Show(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
            Form2 f = new Form2(dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString());<br />
            f.val = dataGridView1.Rows[dataGridView1.CurrentCellAddress.Y].Cells[0].Value.ToString();<br />
            f.Show();<br />
        }


In form 2
        public Form2(string  value1)<br />
        {<br />
            InitializeComponent();<br />
            //getst he value and the value is stored in the txt box<br />
            textBox1.Text = value1;<br />
            DataSet ds = new DataSet();<br />
            //populates the dataset<br />
            ds.ReadXml(@"D:\myappl\Student.xml", XmlReadMode.Auto);<br />
            //assigns the primary key field<br />
            ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns[0] };<br />
            //finds and retrieves the row for the key<br />
            DataRow dr = ds.Tables[0].Rows.Find(textBox1.Text);<br />
            //populates the value you can extends also<br />
            textBox2.Text =Convert.ToString( dr[1]);<br />
<br />
        }<br />


if the Datarow and DataSet object is global and if you give the following code it will be deleted.
<br />
       dr.delete();<br />
       ds.WriteXML(...)<br />


Please tell me whether this is working or not but keeping a linklabel inside a datagrid is not possible if it is a web application then you can do that by keeing the hyper link field in the gridview control and it is possible to hide the primary key also






-- modified at 5:43 Monday 11th June, 2007

Best Regards,
M. J. Jaya Chitra

QuestionWPF relative grid layout help :confused: Pin
ti4n848-Jun-07 19:54
ti4n848-Jun-07 19:54 
QuestionWhich one Is Better...? Pin
Pankaj - Joshi8-Jun-07 19:50
Pankaj - Joshi8-Jun-07 19:50 
AnswerRe: Which one Is Better...? Pin
Muammar©8-Jun-07 20:53
Muammar©8-Jun-07 20:53 
AnswerRe: Which one Is Better...? Pin
Sonia Gupta8-Jun-07 21:01
Sonia Gupta8-Jun-07 21:01 
AnswerRe: Which one Is Better...? Pin
Robert Rohde8-Jun-07 21:56
Robert Rohde8-Jun-07 21:56 
AnswerRe: Which one Is Better...? Pin
Christian Graus8-Jun-07 23:50
protectorChristian Graus8-Jun-07 23:50 
QuestionHow To Check Form Exist Or Not...? Pin
Pankaj - Joshi8-Jun-07 19:10
Pankaj - Joshi8-Jun-07 19:10 
AnswerRe: How To Check Form Exist Or Not...? Pin
Luc Pattyn8-Jun-07 23:29
sitebuilderLuc Pattyn8-Jun-07 23:29 
GeneralRe: How To Check Form Exist Or Not...? Pin
Pankaj - Joshi10-Jun-07 22:19
Pankaj - Joshi10-Jun-07 22:19 
GeneralRe: How To Check Form Exist Or Not...? Pin
Luc Pattyn10-Jun-07 23:26
sitebuilderLuc Pattyn10-Jun-07 23:26 
AnswerRe: How To Check Form Exist Or Not...? Pin
Christian Graus8-Jun-07 23:50
protectorChristian Graus8-Jun-07 23:50 
GeneralRe: How To Check Form Exist Or Not...? Pin
Pankaj - Joshi10-Jun-07 22:21
Pankaj - Joshi10-Jun-07 22:21 
GeneralRe: How To Check Form Exist Or Not...? Pin
Marcel Vreuls (www.agentbase.nl)9-Jun-07 21:55
Marcel Vreuls (www.agentbase.nl)9-Jun-07 21:55 
GeneralRe: How To Check Form Exist Or Not...? Pin
Pankaj - Joshi10-Jun-07 22:56
Pankaj - Joshi10-Jun-07 22:56 
QuestionExe is installed or not check from web Pin
justindhas8-Jun-07 19:00
justindhas8-Jun-07 19:00 
AnswerRe: Exe is installed or not check from web Pin
Sathesh Sakthivel8-Jun-07 19:06
Sathesh Sakthivel8-Jun-07 19:06 
GeneralRe: Exe is installed or not check from web Pin
justindhas8-Jun-07 19:36
justindhas8-Jun-07 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.