|
Rank: Member Groups: Member
Joined: 6/1/2011 Posts: 18
|
I have a dialog control on a page that saves user input, with only one text field. I need to be able to load the existing value in the SQL table that this field is saved to when the user clicks the button to display the dialog. Currently the dialog's ShowButton property is set for the button on the page that the user clicks to display it, so when the dialog shows the text field is blank.
How would I do this?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, You would use something like this to get the TextBox control:
Code: C#
TextBox textBox = (TextBox)dialog1.ContentContainer.FindControl("TextBox1");
The rest would be straight forward. Thanks!
|
|
Rank: Member Groups: Member
Joined: 6/1/2011 Posts: 18
|
Your code appears to load the value from the text field in the dialog to the text field on the web page. I'be got that working. I need to do the opposite when the user clicks the button to display the dialog.
For example, on the page is a label field containing "hello world". I need the label value "hello world" to appear in the dialog content field text field when displayed.
I'm basically trying to allow the user to edit data that is displayed.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
I am not sure if I understood your question correctly. You seem to be asking how to get the content of a label. If that's the case, then you will need to seek other resources because that would be a generic programming questions that has nothing to do with our product. We only offer tech support to our product.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 6/1/2011 Posts: 18
|
I want to take the content of the label and put the value into a text field in your dialog control, before the dialog control is displayed.
Let me ask this. Is there another method/way to display the dialog control through code-behind code rather than setting the ShowButton property? If there is, I can probably copy the label content to the text field before showing the dialog.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
You can set the dialog's InitialState to Visible to display the dialog.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 6/1/2011 Posts: 18
|
Thank you. That does the trick!
|
|