Microsoft
Software
Hardware
Network
Question : How to find dynamic control in Silverlight 3.0?
Hello Experts,
I'm using silverlight 3.0 and I created a text box at run time...But I couldn't find that textbox.... What will I do that?
My C# code as follows
TextBox txtusername1 = new TextBox { Name = "txtusername", Height = 50, Width = 250, FontSize = 20, TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap, Foreground = new SolidColorBrush(Color.From
Argb(255, 173, 216, 230)), Opacity = 0.7 };
txtusername1.SetValue(Canv
as.TopProp
erty , -70d);
Button btnlogin= new Button { Height = 50, Width = 130, Content = "Login",Name="btnLogin" };
btnlogin.SetValue(Canvas.T
opProperty
, 70d);
btnlogin.Click += new RoutedEventHandler(btnlogi
n_Click);
void btnlogin_Click(object sender, RoutedEventArgs e)
{
loginwcfClient wcfclientobj = new loginwcfClient();
wcfclientobj.getloginCompl
eted += newEventHandler(wcfcliento
bj_getlogi
nCompleted
);
wcfclientobj.getloginAsync
(((TextBox
)this.Find
Name("txtu
sername"))
.Text) //Error }
}
because txtusername returns null value How to get it? Thanks in Advance
Answer : How to find dynamic control in Silverlight 3.0?
Try to find you control using FindControl("controlId");
If you use this you should also set the ID property of the textbox to ID="controlId"
Random Solutions
All memory used by SQL Server 2008 + Reporting Services
weather webpart using HTML,CSS and javascript
SQL WHERE sub clause
SBS 2008/Exchange 2007 - offsite website hosting by 1 and 1
Checking a Dataset for DBNull whiclst using the Compute SUM function
How to change SQL 2008 reporting services from native mode to sharepoint integrated mode
Why wont a hp laptop power up?
How to modify a field length on Live Database SQL Server 2008 - Error Message "Saving Changes is not permitted..."
Home network - pc keeps losing internet connection
Explorer.exe breadcrumbs control( How do I get the windows handle?)