Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Can I setup unbounded asp:TemplateField in asp:GridView

$
0
0

Hi,

I wanted to create  gridview that the users can update the value within grid. So, I have " <EditItemTemplate>" and <ItemTemplate> as shown below.

If I bind the grid to a datasource, is there a way that it doesn't really write to the database, but will update the grid? That is the changes show on the grid, but never write to the DB. Please advice. Your help would be greatly appreciated!

<asp:GridView ID="GridView2" runat="server" CellPadding="4"  
            ForeColor="#333333"  AutoGenerateColumns="False"  
            onrowcancelingedit="GridView1_RowCancelingEdit"  
            onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"  
            onrowupdating="GridView1_RowUpdating" > 
            <AlternatingRowStyle BackColor="White" /> 
            <Columns> 
                <asp:TemplateField Visible="False">   

                    <ItemTemplate> 
                        <asp:Label ID="lblPk_id" runat="server"  Text='<%#Eval("xxx")%>'></asp:Label> 
                    </ItemTemplate> 
                </asp:TemplateField> 
                <asp:TemplateField Headertext="ProductId"> 
                    <EditItemTemplate> 
                        <asp:TextBox ID="txtaaa" runat="server"  Text='<%#Eval("aaa")%>'></asp:TextBox> 
                    </EditItemTemplate> 
                    <FooterTemplate> 
                    <asp:TextBox ID="txtaaa" runat="server"  Text='<%#Eval("aaa")%>'></asp:TextBox> 
                    </FooterTemplate> 
                    <ItemTemplate> 
                        <asp:Label ID="lblaaa" runat="server"  Text='<%#Eval("aaa")%>'></asp:Label> 
                    </ItemTemplate> 
                </asp:TemplateField> 

                                 

Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>