Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Addning scrip while using UpdatePanel?

Addning scrip while using UpdatePanel?

Scheduled Pinned Locked Moved ASP.NET
csssysadmindockertoolshelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    thomasa
    wrote on last edited by
    #1

    Is is somehow possible to add a script using UpdatePanel? My problem is that I have a DataGrid containg 2 couloms with 1 TextBox in each. On the first TextBox there is an OnTextChangeEvent with an AutoPostBack="true", and in this function I add scripts to set focus, and select the text on the next TextBox as in: private void OnSubscriptionFromValueChanged(object sender, System.EventArgs e) { TextBox tb = (TextBox)sender; DataGridItem dgi = (DataGridItem)tb.Parent.Parent; TextBox tbToFocus = (TextBox)dgi.FindControl("tbToValue"); Page.ClientScript.RegisterStartupScript(GetType(), "focus", "document.getElementById('" + tbToFocus.UniqueID + "').focus();"); Page.ClientScript.RegisterStartupScript(GetType(), "select", document.getElementById('" + tbToFocus.UniqueID + "').select();"); .. ... .... } This works fine. But then I added an UpdatePanel around the DataGrid, as in asp:UpdatePanel ID="upSubscription" runat="server"> <ContentTemplate> <asp:datagrid id="dgSubscription" runat="server" CssClass="grid" AllowPaging="False" CellPadding="0" GridLines="Vertical" AutoGenerateColumns="False" ShowFooter="true" OnItemCreated="dgSubscription_ItemCreated"> asp:TemplateColumn HeaderText="From value" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="150px"> ItemTemplate> asp:TextBox id="tbFromValue" runat="server" AutoPostBack="true" CssClass="tbStyle0" Text='<%#DataBinder.Eval(Container.DataItem, "decFromValue").ToString()%>'> </asp:TextBox> /ItemTemplate> /asp:TemplateColumn> <asp:TemplateColumn HeaderText="To value" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="150px"> ItemTemplate> asp:TextBox id="tbToValue" runat="server" AutoPostBack="true" CssClass="tbStyle0" Text='<%#DataBind

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups