473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GridView SQLDataSource UserControl Problem

I was wondering if someone would be able to help me with the following:

Simply put, I have built an ASP.NET 2.0 WebUserControl (UC1). UC1
contains: A GridView which is bound to an SQLDataSource control (Stored
Procedure with 2 input parameters). The GridView contains 3 columns
(QuestionNumber, QuestionText, and a TemplateField). The TemplateField is
initially empty at design time and is populated with other UserControls which
are dynamically added and bound in the RowDataBound event of the GridView. I
have disabled the ViewState for the GridView as to ensure that the
RowDataBound event is fired every time. What I need to do is pass UC1, 2
parameters which the SQLDataSource will use to execute the stored procedure.
For this, I have added 2 public (Integer type) properties to UC1 so that they
may be specified dynamically.

I then drag-N-drop an instance of my user control (UC1) onto an empty page.
If I set the value of the 2 properties either in the Pre_Init event or the
control properties window in VS 2005, all works well. If I set the
properties in a Buttons’ Click event, nothing works. As I debug, I can see
that the value of the properties are 0. Its as though the assignment of
these properties in the Button’s Click event is fired too late for UC1 to
process them. In UC1, I use the SQLDataSource’s Selecting event to assign
the parameter values
(SqlDataSource1.SelectParameters("LanguageID").Def aultValue = Me.LanguageID),
and use the Init event to execute the SqlDataSource1.Select method. I am
sure I am doing something wrong with my events, etc…. In essence, I need to
pass SQLDataSource parameters to a user control and make it use those
parameters to execute against an SQL stored procedure

P.S.: Also, Is there a way to disable auto selecting/binding of a
form/SQLDataSource, etc… up until I specify .Selec
Regards,

Giovanni
May 10 '06 #1
0 1586

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my...
4
by: Alexander Widera | last post by:
Hi, I have the following source code: <%@ Register tagprefix="my" tagname="tcontrol" Src="article_small.ascx" %> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
1
by: Giovanni | last post by:
Dear Friends/Gurus, I have exhausted myself and have yet no solution to the following: I have an ASP.NET 2.0 Survey type application. On a page, I have placed a GridView which is bound to an...
3
by: Jason Wilson | last post by:
OK I'm obviously fairly new to ASP.NET 2.0. I've used gridviews in the past but only for pages with static queries that happen onload. Now I have pretty simple scenario and I think I've followed...
0
by: LiamLiamLiam | last post by:
G'day all. I having a problem with my formview. I'll ty to explain my situation as best as i can. I have a page with a search field at the top which is just a simple asp:textbox. Below that i...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
4
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This...
2
by: xMetalDetectorx | last post by:
Hi Everyone, I have a very simple web app that uses .Net 2.0 login control to authenticate users and allow access to an "admin" folder. Inside that admin folder I have one page that has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.