How to get click item value
-
Sunday, September 16, 2012 3:56 AM
Hi.. I have a problem.
I'm Try to build metro app.I retrieved some data from xml and show them using GridView.It has nine columns.( SampleID ,volume ,Count..... like that).
This is my xaml
That binding is properly work.my problem is If I select any details regarding to these columns, I want to get selected item.but I cannot get item value what I clicked.As an example if I click any item under sampleID column I cannot get value what i'm selected.Please help me.I'm in realy trouble.
Here I was changed Tapped="gridview_Tapped_1" event to ItemClick="gridview_Itemclick_1" event.Then here is click event code.
This is not work.So Help me to find Answer...
Thanks..
- Moved by Lisa ZhuMicrosoft Contingent Staff Tuesday, September 18, 2012 6:31 AM metro app related (From:Visual C# General)
All Replies
-
Sunday, September 16, 2012 10:06 AM
Think you need to handle dopostback event in javascript, check this link below it might help you diagnise your problem
http://jgvimalan.wordpress.com/2012/09/15/clickable-gridview-with-postback-in-asp-net-4-0/
Mark it as helpful if so!!! thanks, Mithilesh
-
Monday, September 17, 2012 4:23 AM
Hi Mithilesh..
Thanks for reply to my problem.I tried your post.but GridViewRowEventArgs didn't get.It related to System.Web.UI.Webcontrols.i cannot use that.Any other answer.Thanks..
-
Monday, September 17, 2012 7:43 AM
Hi RaviShan1988,
From your description , I ‘d like to move this post to the most related forum .
There has more experts in this aspect , so you will get better support and may have more luck getting answers .
Thanks for your understanding .
Regards ,
Lisa Zhu [MSFT]
MSDN Community Support | Feedback to us
- Edited by Lisa ZhuMicrosoft Contingent Staff Tuesday, September 18, 2012 6:19 AM
-
Monday, September 17, 2012 7:57 AM
try this one
private void gridview_CellClick(object sender, DataGridViewCellEventArgs e) { if (gridview.SelectedCells.Count > 0) { string id = gridview.SelectedCells[0].Value.ToString(); } }
i hope it will help to u
programmer on .net
-
Monday, September 17, 2012 10:00 AMCan you able to post your full xaml code, inside what is your gridview reside?
Mark it as helpful if so!!! thanks, Mithilesh
-
Tuesday, September 18, 2012 6:34 AMModerator
Hi RaviShan1988,
According to your code, I think e.ClickedItem is definitely not a string. So the TextBox will show nothing.
e.ClickedItem is the item that you bind to the clicked row, not the string value that you bind to a specific TextBox in that row.
Best regards,
Min Zhu [MSFT]
MSDN Community Support | Feedback to us
- Marked As Answer by Min ZhuMicrosoft Contingent Staff, Moderator Thursday, October 04, 2012 8:58 AM
-
Tuesday, September 18, 2012 12:35 PM
Hi Every One..
This is my xaml code.
I'm a beginner for metro apps developing.like this i used 8 GridView .Because if i used single GridView i couldn't select single item as i want and couldn't get the cell value.that's why i used many GridView s.each GridView has ItemClick event and that event gives the value.But i feel there must be easy way to design and get selected value.Is this right?
This is really what i want..
This is ravindu4_ItemClick_1 event that i used to get value.
private void ravindu4_ItemClick_1(object sender, ItemClickEventArgs e)
{
var item = e.ClickedItem as DataList;
var site = item._Site;
this.value = site.ToString();
valueClicked.Text = value;
}Can anybody tell me this pattern is Ok or not.If there is any example that i can understand it will be Helpfull to solve this problem..
Thanks..
-
Friday, September 21, 2012 5:45 AMModerator
Hi RaviShan1988,
Maybe you can also try using the TextBox's GotFocus event to accomplish this. Let me know if your scenario is more complex.
Best regards,
Min Zhu [MSFT]
MSDN Community Support | Feedback to us

