If I have the following settings in my load event I get a record listed in
the formview:
FormView1.DataSource = dsCustomer;
FormView1.DataSourceID = "";
However, the DataSourceID must be set in the properties in design mode to
CustomerDataSource for this to work, if I remove this it does not work.
If I set the FormView1.DataSourceID in the load event to CustomerDataSource
I get a runtime error saying that I cannot have both properties filled.
Sorry I am not sure what you mean about giving you a repro step.
--
Mal Ball
[quoted text, click to view] "Kevin Yu [MSFT]" wrote:
> Hi,
>
> Are you binding the FormView to a class object or to the DataSet? If you're
> binding to the DataSet, is there anything in the data source?
>
> If possible, could you give me a repro step, so that I can try to debug it
> on my machine? Thanks!
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
Hi,
Are you binding the FormView to a class object or to the DataSet? If you're
binding to the DataSet, is there anything in the data source?
If possible, could you give me a repro step, so that I can try to debug it
on my machine? Thanks!
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Hi Mal,
The page remains to be empty, because the item templates of FormView is not
set. To set it fast, you can
1. Set the DataSourceID to certain datasource like dsCustomer at design
time.
2. Clear the DataSourceID field in the properties window.
3. A dialog box will pop up to ask you if you need to clear the templates.
Click No.
Then you can specify DataSourceID at runtime in code. And the data will be
displayed properly. Also make sure to set either DataSource or
DataSourceID. Just don't set both of them.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Ok, I have reset the properties at design time as follows:
DataSourceID = blank
DataMember = blank
DataKeyNames = customerID
At run time in my page load event I have:
dsCustomer = CurrentCustomer.Select(SelectedCustomer);
CustomerDataSource.DataBind();
this.FormView1.DataSourceID = "CustomerDataSource";
or
this.FormView1.DataSource = dsCustomer;
Neither provide data in the form view.
--
Mal Ball
[quoted text, click to view] "Kevin Yu [MSFT]" wrote:
> Hi Mal,
>
> The page remains to be empty, because the item templates of FormView is not
> set. To set it fast, you can
>
> 1. Set the DataSourceID to certain datasource like dsCustomer at design
> time.
> 2. Clear the DataSourceID field in the properties window.
> 3. A dialog box will pop up to ask you if you need to clear the templates.
> Click No.
>
> Then you can specify DataSourceID at runtime in code. And the data will be
> displayed properly. Also make sure to set either DataSource or
> DataSourceID. Just don't set both of them.
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
Thanks for the help and the links, I will experiment further.
--
Mal Ball
[quoted text, click to view] "Kevin Yu [MSFT]" wrote:
> Hi Mal,
>
> In the design mode of the page, can you see the FormView with all fields in
> it? Or just a big grey box?
>
> If not, you can check the following links for more information about
> applying templates to the control.
>
>
http://msdn2.microsoft.com/en-us/library/ms227423.aspx >
http://msdn2.microsoft.com/en-us/library/ms228089.aspx >
> Also, this link will be helpful.
>
>
http://msdn2.microsoft.com/en-us/library/fyf1dk77.aspx >
> The template should be applied first, or the FormView control will not know
> how to display the data.
>
> Kevin Yu
> =======
> "This posting is provided "AS IS" with no warranties, and confers no
> rights."
>
You're welcome, Mal.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Don't see what you're looking for? Try a search.