iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
HI,
i have a valuelist that is a part of a grid (its a dropdownlist). The dropdown shows just fine, but when you select from the drop down, instead of showing what is in the Text field of the valuelist, its showing the value field. This is in 2009 webgrid 7.0
Eric
{
}
grid.RefreshAll();
</script><
</table>
I created a test page based on your information and the code you provide in your posting.
From the code shown in your posting, I was unable to find the “ValueList” tag. So I decided to make a minor change by adding the following “ValueList” tag in my test page.
<ValueList DataSourceID="SqlDataSource2" DataTextField="CultureCodeDescription"
DataValueField="CultureCodeId" DataMember="DefaultView">
</ValueList>
I was unable to repro your issue by using my test page. The sample project is attached. Please make any necessary changes to the test page so that it replicates your issue, and then re-attach it for further investigation.
Yudi, the code behind page is attached above. I cant use the inline method your using since this needs to do a translation on the data first. Please take a look at the attachment and see if this helps.
Hi,
its also important to note that everything works fine, the dropdownlist shows correctly, however, when we add a row, it then shows the data value field in the table and not the data text field.
I was unable to download the attached code behind.Could you please re-attach the code behind in a compressed file format (zip or rar)?
here are both files zipped for you.
I was able to repro your issue based on the attached code behind. It is confirmed as bug.
I have forwarded and reported this issue to WebGrid development team. A work item, #393, has been created regarding this issue. The hotfix file will be available in our upcoming build number of WebGrid.
Please feel free to contact us with any questions or concerns you may have.
Hello Eric,
After investigating your code further, it appears that you implement the ValueList in incorrect event. Instead of initializing the value list in PrepareDataBinding, you should place it in InitializeLayout event to ensure the value list is initialized when needed.
Code sample:
protected void WebGrid2_InitializeLayout(object sender, LayoutEventArgs e) { WebValueList vLang = null; WebGridColumn languageColumn = WebGrid2.RootTable.Columns.GetNamedItem("CultureCode"); if (languageColumn != null) vLang = languageColumn.ValueList; if (vLang != null) { // setup valuelist data vLang.DataTextField = "CultureCodeDescription"; vLang.DataValueField = "CultureCodeId"; if (!vLang.IsDataCached()) { DataTable dt = new DataTable("Languages"); SqlDataAdapter theLanguages = new SqlDataAdapter(); SqlConnection conn = new SqlConnection(SqlDataSource1.ConnectionString); try { string queryLangs = "SELECT CultureCodeId, CultureCodeDescription FROM Culture"; theLanguages.SelectCommand = new SqlCommand(queryLangs, conn); theLanguages.Fill(dt); } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } vLang.DataSource = dt; } } }
Let me know if that works for you.
- James.
I got news from WebGrid development team regarding this issue. After being investigated further by the team, I need to re-clarify that this issue is not bug.
James is correct. Please try to implement the value list in InitializeLayout event rather than PrepareDataBinding server side event. This should solve the issue.
For James: thank you very much for your contribution in our community forum.
I got news from WebGrid development team regarding this issue. After being investigated further by the team, I need to re-clarify that this issue is not bug.James is correct. Please try to implement the value list in InitializeLayout event rather than PrepareDataBinding server side event. This should solve the issue.For James: thank you very much for your contribution in our community forum.
I had the same problem and I moved the loading of the WebValueLookups to the InitializeLayout event and the columns now defaulted the TEXT instead of VALUE.
Hello Shawn,
Ok, I assume that it also works on you because you said it already showed text instead of value. Thank you for your confirmation.
Regards,Handy
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname