昨天放的贴,还没搞定。。谁搞定了这200就是他的了!不够,在加~ Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
        Dim txtTitleBox As New TextBox
        Dim cuEdit As New CuteEditor.Editor
        Dim edit As String
        Dim title As String
        Dim btnCs As New Button
        Dim Cs As String        Dim row As GridViewRow
        row = GridView1.Rows(e.RowIndex)        txtTitleBox = CType(row.FindControl("txtTitle"), TextBox)     //结果是Nothing
        cuEdit = CType(row.FindControl("Editor"), CuteEditor.Editor)  //结果是Nothing
        btnCs=CType(row.FindControl("Button1"), Button)  //这能找到Button1
        Cs=btnCs.Text                                   //这能得到,btnCs.text的值!
        edit = cuEdit.Text                             //Nothing
        title=txtTitleBox.Text                         //Nothing
    End Sub不清楚为何为这样!真的不懂~头都大了!同在一个模板下,为什么有的能找到有的就找不到?有值无值?唉~

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/4766/4766936.xml?temp=.9506494 
    昨天的贴!
      

  2.   

    在前台把Dataview中不用的Template都删了。
      

  3.   


         是不是摸版列里item和edit里都有控件呀 
            如果是这样只有item里有值
                当点编辑时edit里的控件才复值
      

  4.   

    没出错提示!
    下面是前台代码:
                     <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="fileID"  PageSize="1" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating"    ShowHeader="False" AllowPaging="True" > 
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <table style="width: 472px">
                                            <tr>
                                                <td colspan="3">
                                                <%#eval("title") %></td>
                                            </tr>
                                            <tr>
                                                <td colspan="3">
                                                <%#eval("Note") %></td>
                                            </tr>
                                            <tr>
                                                <td style="width: 100px; text-align: right;">
                                                    <asp:HyperLink ID="hlnkHF" runat="server" NavigateUrl="#huiFU">回复</asp:HyperLink></td>
                                                <td style="width: 100px; text-align: right;">
                                                    <asp:LinkButton ID="lnkYy" runat="server">引用</asp:LinkButton></td>
                                                <td style="width: 100px; text-align: right;">
                                                    <asp:LinkButton ID="lnkBj" runat="server" CommandName="edit">编辑</asp:LinkButton></td>
                                            </tr>
                                            <tr>
                                                <td style="width: 100px">
                                                </td>
                                                <td style="width: 100px">
                                                    </td>
                                                <td style="width: 100px">
                                                    </td>
                                            </tr>
                                            <tr>
                                                <td >
                                                    </td>
                                                <td >
                                                    </td>
                                                <td >
                                                <%#getID(Eval("fileID"))%>
                                                    </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <table style="width: 473px; height: 142px">
                                            <tr>
                                                <td style="width: 153px; height: 3px">
                                        <asp:TextBox ID="txtTitle" runat="server"></asp:TextBox></td>
                                            </tr>
                                            <tr>
                                                <td style="width: 153px">
                                                    <CE:Editor ID="Editor" runat="server" AutoConfigure="Simple" Height="113px" Width="395px">
                                                        <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"
                                                            CssClass="CuteEditorFrame" Height="100%" Width="100%" />
                                                    </CE:Editor>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 153px">
                                        <asp:Button ID="btnTJ" runat="server" CommandName="update" Text="提交" UseSubmitBehavior="False" /></td>
                                            </tr>
                                        </table>
                                    </EditItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
    先去吃饭。一会回来试试搞定了马上结贴!
    谢谢大家!
      

  5.   

    说明一下~Button1因为是用来测试用的~所以测试能取到值后,就删了那个控件了。
    在前台没有!别说我前后不一样。嘿嘿~
    吃饭去~
      

  6.   

    你测试用的Button1是放在<ItemTemplate>里还是<EditItemTemplate>里?
    ==
    感觉:row = GridView1.Rows(e.RowIndex)这里不太对
      

  7.   

    Dim row As GridViewRow
    row = GridView1.Rows(GridView1.EditIndex)
      

  8.   

    或者是:
    row = GridView1.Rows(e.EditIndex)
    你自己测试一下吧
      

  9.   

    EditItemTemplate模板里!
    在RowUpdating事件里是不能e.EditIndex得到索引的呀!!只能是e.RowIndex这个呀!
      

  10.   

    看看是不是GridView1_RowEditing和GridView1_RowCancelingEdit的问题
      

  11.   

    你的编辑和提交换成类似下面的这样看看
    <asp:CommandField CancelText="取消" UpdateText="修改" EditText="编辑" DeleteText="删除" ShowDeleteButton="True" ShowEditButton="True"/>
    ===
    参考一下:http://lovecherry.cnblogs.com/archive/2006/05/12/398169.html
    不过是c#的
      

  12.   

    看看webconfig中的viewstate,页面的viewstate,控件的viewsate,三级viewstate设置禁用了吗?
      

  13.   

    web.config文件中没有对viewstate进行设置!
    因为我都找不到有这个字符串~
    应该没这的关系吧??
    小弟放出第三贴了
    http://community.csdn.net/Expert/topic/4769/4769528.xml?temp=.5392572大哥们有兴趣,也愿意。。帮帮菜鸟的话可以试试!搞定的话三贴的分全给他!
    谢谢!
      

  14.   

    在次UP!第三贴地址!总分到300了。。
    http://community.csdn.net/Expert/topic/4769/4769528.xml?temp=.9013178
    在线等。。
    求大大门。。给个demo吧!!!!!([email protected])
    VS2005(VB.NET)手动绑定数据!能获取值就OK!分不够。。我在加。。把分用完我也愿意!
    我找了好些资料了,都像下面这样说!可在我这真不行!
    GridView (2.0)Event "RowUpdating"Dim rowChoice As Integer = e.RowIndex
    Me.txtFN.Text = CType(Me.GridView1.Rows(rowChoice).FindControl("TextBox1"), TextBox).Text
    Me.txtLN.Text = CType(Me.GridView1.Rows(rowChoice).FindControl("TextBox2"), TextBox).Text
      

  15.   

    谢谢帮我顶贴的大哥们~谢谢!问题5天后的现在我搞定了!
     If Not Me.Page.IsPostBack Then
                *  '数据绑定
            End If
    菜鸟的可悲现在想想细细分析一下,也就明白了!
    -------------------------------------------------------
    ld_thinking(懒得想) 
    是不是又是IsPostBack之类? 
    -------------------------------------------------------
    前辈就是辈!我当初没听你的是因为我在绑定函数里做有IsPostBack的判断!
    但哪个只是针对用那个SQL语句就行绑定,没反应过来!
    谢谢大哥!