//我有如下aspx文件,請問怎麼讓自定義的過程OnMouseDown(int i)在編譯過過的腳本中調用!
<%@ Page Language="VJ#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server">
  
    public void OnMouseDown(int i)//自定義過程
    {
        GridView1.set_SelectedIndex(i);        
    }
    void BindData()
    {
        System.Data.SqlClient.SqlConnection con;
        System.Data.SqlClient.SqlCommand Com;
        System.Data.SqlClient.SqlDataAdapter Ada;
        System.Data.DataSet ds;
        con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.get_ConnectionStrings().get_Item("Personal").get_ConnectionString());
        con.Open() ;
        Com = new System.Data.SqlClient.SqlCommand("Select * from AppMenu", con);
        Ada = new System.Data.SqlClient.SqlDataAdapter(Com);
        ds = new System.Data.DataSet("AppMenu");
        Ada.Fill(ds);
        GridView1.set_DataSource(ds);
        GridView1.DataBind();
        con.Close() ;
        con.Dispose() ;
        con=null ;
        Com.Dispose(); ;
        Ada.Dispose();
        ds.Dispose(); 
    }
    protected void Button1_Click(Object sender, EventArgs e)
    {
        BindData();
    }
    protected void GridView1_ItemDataBound(Object sender, DataGridItemEventArgs e)
    {
        System.String  str;
        str = Convert.ToString(e.get_Item().get_ItemIndex());
        e.get_Item().get_Attributes().Add("onmousedown", " OnMouseDown("+str +");");//腳本中調用
        
    }    protected void GridView1_PageIndexChanged(Object source, DataGridPageChangedEventArgs e)
    {
        GridView1.set_CurrentPageIndex(e.get_NewPageIndex());
        BindData();
    }
</script><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />&nbsp;</div>
        <asp:DataGrid ID="GridView1" runat="server" Height="330px" Width="493px" OnItemDataBound="GridView1_ItemDataBound" CellPadding="4" GridLines="None" AllowPaging="True" ForeColor="#333333" OnPageIndexChanged="GridView1_PageIndexChanged" >
            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" Mode="NumericPages" />
            <AlternatingItemStyle BackColor="White" />
            <ItemStyle BackColor="#EFF3FB" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <EditItemStyle BackColor="#2461BF" />
        </asp:DataGrid>
    </form>
</body>
</html>
以上方式是否有方法行的通,如果不行該怎麼處理?謝謝!