Welcome Guest Search | Active Topics | Sign In | Register

Retrieve Dropdown list value from the grid Options
swamysm
Posted: Tuesday, February 15, 2011 1:34:23 AM
Rank: Newbie
Groups: Member

Joined: 2/14/2011
Posts: 7
I need help in this.
My Requirement

There is a database with column 1 and column 2 with values
The grid will be retrieving Column 1 and column 2 and the user will add column 3 as his comments
In grid the column 3 will be having drop down list with values

On save the selected drop down values on grid must be saved in the database..
Please help me in C# coding in retrieving drop down list value in EO

Regards
eo_support
Posted: Tuesday, February 15, 2011 8:18:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

We don't provide coding service or advice on implementation. So you can not just give us your requirement and ask us to code for you. You will need to go over the documentation and samples first and ask us if you still have any specific question.

Thanks!
swamysm
Posted: Tuesday, February 15, 2011 10:25:30 AM
Rank: Newbie
Groups: Member

Joined: 2/14/2011
Posts: 7
Hi,
I got your point.. I am sorry for keeping those requirements in the forum,

I have taken the same code from the demo link for the drop down values as per my requirement.


http://demo.essentialobjects.com/Demos/Grid/Features/Custom%20Column%20-%20Advanced/Demo.aspx

created a new project as it is and tried with the same C# code which is been used there

protected void Page_Load(object sender, System.EventArgs e)
{
//Get the Repeater control so that we can fill it
//later
EO.Web.CustomColumn productColumn =
(EO.Web.CustomColumn)Grid1.Columns[1];
Repeater productRepeater =
(Repeater)productColumn.EditorInstance.FindControl("Products");

//Fill the repeater from the database
using (DemoDB db = new DemoDB())
{
productRepeater.DataSource = db.ExecuteReader("SELECT * FROM Products");
productRepeater.DataBind();
}
}

protected void Button1_Click(object sender, System.EventArgs e)
{
foreach (EO.Web.GridItem item in Grid1.AddedItems)
{
//Get the product name
string productName = (string)item.Cells[1].Value;

//Get the product quantity. Note user may have
//entered something other than a number, so we
//also check that
int productQty = 0;
try
{
productQty = int.Parse((string)item.Cells[2].Value);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);

//Ignore the exception
}

//The Grid provides all the information about what
//have been added/changed, but it does not save them
//to the database for you. You should write code to
//use whatever means that's best/easiest for you to
//save the newly added item here

//Add your code to save productName and productQty
//into the database
}

Label1.Visible = true;
}



My requirements here is...
I am able to bind the data to the grid view (as per using above code)but when we click save the selected value/edited values in the grid is not saving in the data base..(backend)

I am using EO controls first time in .net C# Please help me in finding solution for this
Please let me know any properties needs to be enabled/classes/objects or any setting needs to be done in the aspx.cs page.

eo_support
Posted: Tuesday, February 15, 2011 10:31:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

You really need to read the documentation first. It explained everything step by step. For example, the documentation already explained that the Grid will not automatically save changes for you (so you will need to write code to do so). Yet you are posting sample code as is asking us why your changes are not saved. We are here to help you solving problems, but we are not a shortcut for you to skip the documentation.

Thanks!
swamysm
Posted: Tuesday, February 15, 2011 11:42:03 PM
Rank: Newbie
Groups: Member

Joined: 2/14/2011
Posts: 7
Hi
I have gone through the available documents relating to this.. Since i am using EO first time I am unable to find the exact solution..

I have used the same code as i mentioned in the pervious..
I am getting an error at

//Fill the repeater from the database
using (DemoDB db = new DemoDB())
(**** error message: Missing assembly directive/reference)

Iam not sure about this funtionaliy in EO how to call assembly directive/reference..
I will be able write code for save provided i could understood the error message..



I am not sure
eo_support
Posted: Wednesday, February 16, 2011 7:28:11 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi,

Please ask someone around you for such compiler errors. Your problem is not that you do not know how to use our product. Your problem is you do not know how to program. You basically just copy code from our samples but couldn't understand any of them.

Please review our support policy here:

http://www.essentialobjects.com/forum/postst1368_Product-support.aspx

It is required that you have basic ASP.NET/HTML/.NET programming knowledge to use our product and there isn't much we can do if you do not know those. We can not afford to assist you on such basic programming errors.

Thanks
Murali S
Posted: Friday, February 18, 2011 1:11:33 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2011
Posts: 1
Hi Team,
Even am facing the same kind of issue,

Can u just guide me how to take the reference of the text box : what ever the text entered in text box need to update in database when i clicked on SAVE.

Am able to do the same in gridview but unable to do it in EO-Grid?


Thanks in advance,
Murali
eo_support
Posted: Friday, February 18, 2011 7:20:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,080
Hi Murali S,

The sample code swamysm copied and posted already has everything you need.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.