点击datagrid中的一行,将这一行的某一列中的一个字符串取出,然后显示在textbox中,如何实现?
关键是如何响应这个点击事件
关键是如何响应这个点击事件
解决方案 »
- 关于链接SQL
- ASP.NET 创建控件出错,值不在预期范围内该怎么解决呢?
- <a href>与gridview配合使用的问题
- 这么写activex,还有如何调用
- 利用MyCalendar查询当天日期下的内容,总是报错:从char 数据类型到datetime 数据类型的转换导致datetime 值越界
- 自己制作一个控件,但需要包函JS和CSS文件,这种情况如何封装和调用!
- 如何将字段值为0或者1的改成具体的字符呢?
- 推荐几本学习ASP.NET的好书
- 紧急求购公文流转系统源码
- ??有谁遇到过此问题啊=======有何办法让服务器端按钮只执行该事件里面的代码??
- 奇怪:枪毙dataset中的一个表时,它挂出免死金牌,气得我直吐血...哪位军事指点一下?谢谢。。。
- 发布的问题,会引发脚本错误
If e.Item.ItemType = ListItemType.Item Or _
e.Item.ItemType = ListItemType.AlternatingItem Or _
e.Item.ItemType = ListItemType.SelectedItem Then
e.Item.Attributes.Add("onclick", "javascript:return doublecl('" & e.Item.ItemIndex + 1 & "');") If TextBox2.Text = CStr(e.Item.ItemIndex + 1) Then
e.Item.BackColor = Color.Red
End If
End Ifend sub
<script>
function doublecl(e)
{ if (confirm("are you sure delete " + e + "?"))
{ document.getElementById("TextBox2").value=e
document.Form1.submit()
document.getElementById("hideIDdelete").click();
}
}
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadcall binddatagrid()
For i = 0 To datagrid.items.count
AddHandler CType(dgListArticle.Items(i).Cells(5).FindControl("DropDownList1"), DropDownList).SelectedIndexChanged, AddressOf Selectchange
Next
end subPrivate Sub Selectchange(ByVal sender As Object, ByVal e As System.EventArgs)
Dim drop As DropDownList
Dim s As String
Dim str As String
Dim arr As Array drop = CType(sender, DropDownList)
arr = drop.ClientID.Split("_")
str = "第" & CInt(arr(2).ToString.Substring(3)) - 2 & "個的"
s = drop.SelectedItem.Text
Response.Write("<script>alert('" & str & s & "')</script>")
End Sub
<script>
function doublecl(e)
{ if (confirm("are you sure delete " + e + "?"))
{ document.getElementById("TextBox2").value=e
document.Form1.submit()
document.getElementById("hideIDdelete").click();
}
}这些代码放哪儿?
页面上部有一个datagrid,下面是一些textbox,每个textbox对应着上面datagrid的一列,当点击datagrid一行时,textbox显示该行的内容
if (e.CommandName.ToString()=="Select")
{
TextBox1.Text=e.Item.Cells[1].Text.ToString(); //取得该列的id
TextBox2.Text=e.Item.Cells[2].Text.ToString(); //取得该列的....
}
能用c#写吗?BTW:我对JS不大懂,再弱弱的问一句
<script>
function doublecl(e)
{ if (confirm("are you sure delete " + e + "?"))
{ document.getElementById("TextBox2").value=e
document.Form1.submit()
document.getElementById("hideIDdelete").click();
}
}这些代码放哪儿?
放在HTML中HEAD中
<script>
function doublecl(e)
{
document.getElementById("TextBox2").value=e
document.Form1.submit()
}
</script>
//双击DataGrid的行引发事件
e.Item.Attributes.Add("dbclick", "javascript:setValue()");放置一个隐藏控件
<script language="javascript">
<!--
function setValue()
{
window.document.form1.Isdbclick.value="true";
---Form 的 ID
window.document.form1.submit();
}
-->
</script><input type="hidden" name="Isdbclick" value="false">private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if (Page.IsPostBack)
{
if (Request.Form["Isdbclick"]!=null)
{
{
if (Request.Form["Isdbclick"].ToString()=="true")
{
f(1);
}
}
}
}public void f(int id)
{
...给TextBox赋值
}