如何在dropdownlist jquery中显示gridview第n行值? [英] How to display gridview nth row value in dropdownlist jquery?

查看:46
本文介绍了如何在dropdownlist jquery中显示gridview第n行值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在下拉列表框中显示gridview行值,我已经使用了下面的代码用于文本框,但它不适用于下拉列表框。



我尝试过:



var row = $(this).closest('tr');

var ID = row.find(td:first)。text();

$(#<%= TextBox12.ClientID%>)。val(ID) ;

解决方案

(this).closest('tr');

var ID = row.find(td:first) .text();


(#<%= TextBox12.ClientID%>)。val(ID);


< blockquote>这是一个简单gridview的例子,点击按钮,一列值被加载到下拉列表中,希望这有帮助



 <%@     Page    语言  =  C# < span class =code-attribute>   AutoEventWireup   =  true    EnableEventValidation   =   false    CodeBehind   =  gridvJq.aspx.cs   继承  =  WebApplication1.gridvJq < span class =code-attribute>  %>  

< !DOCTYPE html >

< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = server >
< script src = Scripts / jquery-1.7.min.js > < / script >
< script src = Scripts / jquery-1.7.js > < / script >
< script type = text / javascript >


I need to display the gridview row value in the dropdownlist box and i have used the below code for the textbox but it doesn't work for the dropdownlist box.

What I have tried:

var row = $(this).closest('tr');
var ID = row.find("td:first").text();
$("#<%=TextBox12.ClientID%>").val(ID);

解决方案

(this).closest('tr');
var ID = row.find("td:first").text();


("#<%=TextBox12.ClientID%>").val(ID);


Here is one example with simple gridview, on button click, one column values are loaded into dropdownlist, hope this helps

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="gridvJq.aspx.cs" Inherits="WebApplication1.gridvJq" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-1.7.min.js"></script>
    <script src="Scripts/jquery-1.7.js"></script>
    <script type="text/javascript">


这篇关于如何在dropdownlist jquery中显示gridview第n行值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆