Showing posts with label Textbox. Show all posts
Showing posts with label Textbox. Show all posts

Wednesday, August 24, 2011

jQuery access textbox within GridView

If you want to access the textbox in the gridview example below, use
$("table[id*=ResultGridView] input[type=text][id*=date]")

<asp:GridView ID="ResultGridView" runat="server" OnRowDataBound="ResultGridView_RowDataBound">
       
<Columns>

           
<asp:TemplateField>

               
<ItemTemplate>

                   
<asp:TextBox ID="date" runat="server"></asp:TextBox>
dd/MM/yyyy                  </ItemTemplate>
           
</asp:TemplateField>

       
</Columns>

   
</asp:GridView>
 

Auto-resize textbox

Facebook like textboxes

Download this jquery plugin
http://james.padolsey.com/demos/plugins/jQuery/autoresize.jquery.js

Then apply this for your textbox

$('textarea#comment').autoResize({
    // On resize:
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    // After resize:
    animateCallback : function() {
        $(this).css({opacity:1});
    },
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40
});