Sergio990 0 Posted January 27, 2011 Report Share Posted January 27, 2011 Boas. Eu tenho este codigo: <asp:BoundField DataField="nomeInterconect" HeaderText="nomeInterconect" SortExpression="nomeInterconect" /> Isso esta a colocar o nome do interconect num campo de uma gridView. O que eu queria era que ele colocasse la o nome do interconect mas que depois ao seleccionar a celula ele me desse o idInterconect. Ou seja fazer como numa dropDownList em que o text é X mas o value é Y. Com os melhores cumprimentos, Sérgio Rodrigues Link to post Share on other sites
Tiago Salgado 2 Posted January 27, 2011 Report Share Posted January 27, 2011 Na query que estás a usar para alimentar o teu DataSource, incluis também o idInterconect e depois na GridView adicionas algo do tipo DataKeys="idInterconect". <asp:GridView runat="server" id="grid" DataKeyNames="idInterconect"> </asp:GridView> Depois consegues acesso fazendo algo como: variavel = grid.DataKeys[index_da_linha_que_queres].Value; Link to post Share on other sites
Sergio990 0 Posted January 28, 2011 Author Report Share Posted January 28, 2011 É isso mesmo Thanks Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now