Link to home
Start Free TrialLog in
Avatar of paiman01
paiman01

asked on

C# ASP.NET Post Values Not Setting

Hello all,
I am not exactly new to .net and C# web apps.  However, I am experiencing an odd situation. I have a ComponentArt grid that has a list of records.  It is very similar to the asp.net grid but it has more built in functions.  
I have a code for each row with the following
<a href="javascript:DoGridPostPack('## DataItem.GetMember('ID').Value ##');">Details</a> <br />
This is a link that will call a javascrip function as below
                     function DoGridPostPack(iID) {
                         __doPostBack('<%=cmdGridDetailsPostBack.ClientID%>', iID);
                     }
I am using "cmdGridDetailsPostBack" as my hidden button to rais the post back with.  The process fires and the server get a record and populates a form in a ajax modal popup for the user to edit details etc.
Here is my challenge.
all of this works fine outside of the grid.  But if i click on the grid link (same exact link and code) the modal popup form comes up but only the read only textboxes keep their value that was set via the server.  All the editable textboxes and comboboxes don't keep the values.
I don't get any errors, or exceptions.  
I am kinda stupped.  Any help would be great.
 
ASKER CERTIFIED SOLUTION
Avatar of Ravi Vaddadi
Ravi Vaddadi
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of paiman01
paiman01

ASKER

Ok,
So there is no value in the form as of the postback. The form is populated based on the record you want to see from the grid.  The trouble is that if i create a javascript postback out side of the grid it works. From the grid it does not.  I can't see any difference between the 2 in code.  Only difference is that the grid replicates the "<a " tag for each item in the grid.  
The values are populated from the server side code, and then the ajax popup is shown.  From out side the grid the "copy and paste" of the javascript postback works.  From inside the grid it does not.
As I understand, your grid has a Details link and when clicked it is supposed to pop up aa AJAX form with values for the selected record and some of those values should be editable.  Sounds right?
Where are you populating the records into form? I mean you are making an AJAX call to fetch the details and after fetch is complete you get a call back where your code pitchs in and populates the controls with the relevant data. sound right?
It might help if you could please post that snippet of code




Hello,
I love to copy the code here, but it's so many functions and events that fill different parts of the request it would be too confusing for all of us.
So the sequence is this (and please keep in mind it all works 100% out side of the grid):
1. Hyper link clicked with a call to javascript function
                     function DoGridPostPack(iID) {
                         __doPostBack('<%=cmdGridDetailsPostBack.ClientID%>', iID);
                     }
iID is the record ID to get the info for and to fill in the forms values.  The server functions work perfectly the get the correct data and fill in the form.
2. The server functions pull the record for that id and fill in the form that is inside a ajax popup.
3. After filling in the values the server functions do a popup.show();

Now all of this works perfectly out side of the grid.  But if i take the link and put it into the grid, it fires the events, the server get the correct values, fills the forms, but when it shows the popup the textboxes that are not set to ReadOnly don't keep the values assiged by the server, they are blank.

This is why it's odd to me.  Why do the readonly text boxes get values, but not the normal state textboxes.  
Hope this gives you a better picture.
Here is the link that is inside the grid
<a href="javascript:DoGridPostPack('## DataItem.GetMember('ID').Value ##');">Details</a> <br /> and I have tried it this way as well
<a href="#" onclick="DoGridPostPack('## DataItem.GetMember('ID').Value ##');">Details</a> <br />  both do the same thing and i get the same behavior.
Thanks
As it seems to me It could be that the values populated are being overwritten some where in the code with empty values.
Please find the references to one of those text boxes and check all the places where the value is being modified.
Hi,
Thanks, i actually did that.  I stped through the code several time watching the value of each text box.  Keep in mind it all works 100% out side of the grid.  Other controls on the same screen make calls to the same function set, and it work perfectly from there.  The link it self works 100% as well out side of the grid.  But once placed inside the grids list, the behavior happens. Its odd.   I have step through the prerender, the unload, every phase of the pages lifecycle, i can't see why the setting of the values would only stick for the readonly controls and not the normal state controls.  If i switch the state of the textboxes to readonly then the values come through.  I don't have any javascript functions that clear or set values to them, it's all done from the server side.
I am wondering is there a behavior in .NET that i am not aware of that doing a  __doPostBack requires more handeling than simply calling functions when you do it in a grid.
The issue was that ComponentArt control was out-dated.
thanks