Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 17th, 2005, 05:00 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default User COntrol Datagrid inside datagrid

Hi All,
I am having some trouble with a datagrid that is a user control when using it inside a datagrid.
Basically as part of the edit template I have included a user control that is a databound control.
In the ItemDatabound event I set the user controls "ResourceID" (Public Field in user control), and it loads up fine.
Then I click on an image button to edit the User control datagrid record and this loads up fine also showing the edit template as it should.
When I go to save the changes, the user control seems to lose track of the "ResourceID" I have assigned to it and defaults back to zero.
The update to the database then assigns the wrong ResourceID.

Any Assistance would be appreciated.




======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
  #2 (permalink)  
Old January 17th, 2005, 11:08 PM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I still don't know why this is happening but I have found an UGLY solution.

Basially I had to pass back both the recordID and the ResourceID mentioned below as a constucted Command Argument (3-6) of the user control Datagrid.
Then split the cammand argument to get the record ID to update the database and the Resource ID to reset the local varaible.

Still very strange as this is not required when not used within a datagrid.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
  #3 (permalink)  
Old April 14th, 2007, 08:38 AM
Registered User
 
Join Date: Apr 2007
Location: Noida, , India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've a similar problem. I've public field in usercontrol, i set it on aspx through databind. I use this control inside/outside datagrid, the only place when user control does not display any value is when I re-bind the grid on some button event of aspx. I tried to analyze the problem and found that Public field value is set at end whereas Oninit, onload are fired by then.

I can post complete help files, please help me resolving it. TittleJoseph@yahoo.com I'm getting mad

ProjectDetail.ascx.cs
 public string ProjectCode
    {
        set { this.projectCode = value; }
        get { return this.projectCode; }
    }
protected override void OnLoad(EventArgs e)
{
txtProjectCode.Text = projectCode;
}

a.aspx

<asp:datagrid ..>
 <ItemTemplate>
             <HCL:ProjectDetail id="ProjectDetail3" runat="server"
              ProjectCode='<%#Container.DataItem%>'
               />
..</asp:datagrid>

a.aspx.csprivate void bindgrid()
    {
        ArrayList AR = new ArrayList();
        AR.Add("C052532");
        AR.Add("C060879");
        DG.DataSource = AR;
        DG.DataBind();
    }

    protected void re_bind_Click(object sender, EventArgs e)
    {
        bindgrid();
    }

------
TittleJoseph@yahoo.com
  #4 (permalink)  
Old April 14th, 2007, 11:11 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What about if you make the property directly access the textbox instead of the intermediate variable. Then you don't have to rely on a control load event (onInit) to set the textbox property.

-Peter
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
get value of textbox inside datagrid khaink ASP.NET 1.0 and 1.1 Basics 9 October 2nd, 2007 11:05 AM
DropDownList Inside a datagrid @shish ASP.NET 1.0 and 1.1 Professional 3 January 29th, 2007 07:24 PM
User Control for datagrid paging mike_remember ASP.NET 1.0 and 1.1 Professional 0 December 29th, 2005 08:59 AM
user control within datagrid lily611 General .NET 1 March 30th, 2005 07:53 PM
Datagrid in a User control Vishal_7 ASP.NET 1.0 and 1.1 Professional 0 January 25th, 2005 11:29 AM



All times are GMT -4. The time now is 10:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.