Click here to Skip to main content
15,912,400 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: child item command event not firing from parent datagrid. Pin
uglyeyes1-Jan-08 11:31
uglyeyes1-Jan-08 11:31 
GeneralGeneric page Pin
pmillio17-Dec-07 10:54
pmillio17-Dec-07 10:54 
GeneralRe: Generic page Pin
Michael Sync17-Dec-07 15:26
Michael Sync17-Dec-07 15:26 
QuestionIE7 Drop Down Issue [modified] Pin
bluewavestrider17-Dec-07 6:04
bluewavestrider17-Dec-07 6:04 
GeneralRe: IE7 Drop Down Issue Pin
Michael Sync30-Dec-07 16:14
Michael Sync30-Dec-07 16:14 
GeneralCrystal Report Pin
Sarfaraj Ahmed17-Dec-07 5:36
Sarfaraj Ahmed17-Dec-07 5:36 
GeneralRe: Crystal Report Pin
Manoj G17-Dec-07 7:57
Manoj G17-Dec-07 7:57 
QuestionAddning scrip while using UpdatePanel? Pin
thomasa17-Dec-07 5:11
thomasa17-Dec-07 5:11 
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)<br />
        {<br />
            TextBox tb = (TextBox)sender;<br />
DataGridItem dgi = (DataGridItem)tb.Parent.Parent;<br />
TextBox tbToFocus = (TextBox)dgi.FindControl("tbToValue");<br />
                        Page.ClientScript.RegisterStartupScript(GetType(), "focus", "<script>document.getElementById('" + tbToFocus.UniqueID + "').focus();</script>");<br />
                        Page.ClientScript.RegisterStartupScript(GetType(), "select", <script>document.getElementById('" + tbToFocus.UniqueID + "').select();</script>");<br />
..<br />
...<br />
....   <br />
}

This works fine.

But then I added an UpdatePanel around the DataGrid, as in
<br />
asp:UpdatePanel ID="upSubscription" runat="server"&gt; <br />
                                &lt;ContentTemplate&gt;  <br />
                                    &lt;asp:datagrid id="dgSubscription" runat="server" CssClass="grid" AllowPaging="False" CellPadding="0"<br />
		                                GridLines="Vertical" AutoGenerateColumns="False" ShowFooter="true" OnItemCreated="dgSubscription_ItemCreated"&gt;<br />
		                                		                                    asp:TemplateColumn HeaderText="From value" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="150px"&gt;<br />
				                                				                              ItemTemplate&gt;<br />
					                                asp:TextBox id="tbFromValue" runat="server" AutoPostBack="true" CssClass="tbStyle0" Text='&lt;%#DataBinder.Eval(Container.DataItem, "decFromValue").ToString()%&gt;'&gt;						                        <br />
					                                &lt;/asp:TextBox&gt;<br />
					                                				                                /ItemTemplate&gt;<br />
				                                			                                /asp:TemplateColumn&gt;<br />
&lt;asp:TemplateColumn HeaderText="To value" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="150px"&gt;<br />
				                                ItemTemplate&gt;<br />
					                                asp:TextBox id="tbToValue" runat="server" AutoPostBack="true" CssClass="tbStyle0" Text='&lt;%#DataBinder.Eval(Container.DataItem, "decToValue").ToString()%&gt;'&gt;						                        <br />
					                                &lt;/asp:TextBox&gt;					<br />
				                                &lt;/ItemTemplate&gt;<br />
				                                <br />
			                                /asp:TemplateColumn&gt;<br />
asp:datagrid&gt;<br />
	                            /ContentTemplate&gt;<br />
	                        /asp:UpdatePanel&gt; <br />


Now the focus and the select is lost, since the page only updated the DataGrid, and the
Page.ClientScript.RegisterStartupScript(GetType(), "focus", "&amp;lt;script&amp;gt;document.getElementById('" + tbToFocus.UniqueID + "').focus();&amp;lt;/script&amp;gt;");<br />
                        Page.ClientScript.RegisterStartupScript(GetType(), "select", "&amp;lt;script&amp;gt;document.getElementById('" + tbToFocus.UniqueID + "').select();&amp;lt;/script&amp;gt;");<br />
wasn't reggisterd at the Page.

Does anyone know a way around this?

Like creating a ScriptManager inside a UpdatePanel (thus that wan't work, as the ScriptManger has to be before a
control that uses scrips). I'm usint .Net 2.0 in Visual Studio 2005 enviroment.
Thanks
Thomas
Generalpaypal Pin
Mogaambo17-Dec-07 4:28
Mogaambo17-Dec-07 4:28 
GeneralRe: paypal Pin
Sathesh Sakthivel17-Dec-07 5:19
Sathesh Sakthivel17-Dec-07 5:19 
GeneralRe: paypal Pin
Mogaambo17-Dec-07 21:46
Mogaambo17-Dec-07 21:46 
GeneralRe: paypal Pin
Paul Conrad23-Dec-07 8:14
professionalPaul Conrad23-Dec-07 8:14 
Questionhow to edit DetailsView control in a Edit Mode? Pin
hurrem17-Dec-07 4:19
hurrem17-Dec-07 4:19 
Generalpassing the values from one web page to another webpage Pin
venkatramana_arutla17-Dec-07 3:42
venkatramana_arutla17-Dec-07 3:42 
GeneralRe: passing the values from one web page to another webpage Pin
Paddy Boyd17-Dec-07 4:13
Paddy Boyd17-Dec-07 4:13 
GeneralRe: passing the values from one web page to another webpage Pin
Usharva17-Dec-07 17:17
Usharva17-Dec-07 17:17 
GeneralRe: passing the values from one web page to another webpage Pin
Gandalf_TheWhite17-Dec-07 18:38
professionalGandalf_TheWhite17-Dec-07 18:38 
GeneralPassing ImageUrl in Javascript function Pin
.NET- India 17-Dec-07 2:18
.NET- India 17-Dec-07 2:18 
GeneralRe: Passing ImageUrl in Javascript function Pin
Michael Sync17-Dec-07 16:25
Michael Sync17-Dec-07 16:25 
GeneralRe: Passing ImageUrl in Javascript function Pin
.NET- India 17-Dec-07 18:17
.NET- India 17-Dec-07 18:17 
QuestionURI formats are not supported...!...? Pin
Sebastian T Xavier17-Dec-07 2:04
Sebastian T Xavier17-Dec-07 2:04 
AnswerRe: URI formats are not supported...!...? Pin
Sebastian T Xavier17-Dec-07 6:01
Sebastian T Xavier17-Dec-07 6:01 
QuestionSearch on the webpage Pin
hirennn17-Dec-07 2:03
hirennn17-Dec-07 2:03 
GeneralRe: Search on the webpage Pin
Paddy Boyd17-Dec-07 2:31
Paddy Boyd17-Dec-07 2:31 
JokeRe: Search on the webpage Pin
Abhijit Jana17-Dec-07 2:45
professionalAbhijit Jana17-Dec-07 2:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.