473,574 Members | 3,130 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmatic set GridView1 SelectedIndexCh anged

I am having trouble programmaticall y setting the SelectedIndexCh anged
of a GridView.

Code as follows.
Panel Panel1 = new Panel();
GridView g = new GridView();
ObjectDataSourc e o = new ObjectDataSourc e();
//load objectdatasourc e using webservice
o.SelectMethod = "getAllCCF" ;
o.TypeName = "testitoccfws.P DAFServices";
//Bind to Gridview
o.DataBind();
g.AutoGenerateS electButton = true;
g.DataSource = o;
g.DataBind();
g.SelectedIndex Changed += new
System.EventHan dler(this.GridV iew1_SelectedIn dexChanged()); ----This
line has an error
Panel1.Controls .Add(g);

here is the method i wish to handle the event.
void GridView1_Selec tedIndexChanged (object sender, e)
{
GridViewRow row = o.SelectedRow;
TextBox1.Text = row.Cells[1].Text;
}

Can someone please take a look and please tell me what I am doing
wrong?

Thanks,

KC

Jan 19 '06 #1
2 6698
Netmonster,
if you type "g.SelectedInde xChanged +=" and then hit the TAB key 2X,
the IDE will fill in everyting correctly for you.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Netmonster " wrote:
I am having trouble programmaticall y setting the SelectedIndexCh anged
of a GridView.

Code as follows.
Panel Panel1 = new Panel();
GridView g = new GridView();
ObjectDataSourc e o = new ObjectDataSourc e();
//load objectdatasourc e using webservice
o.SelectMethod = "getAllCCF" ;
o.TypeName = "testitoccfws.P DAFServices";
//Bind to Gridview
o.DataBind();
g.AutoGenerateS electButton = true;
g.DataSource = o;
g.DataBind();
g.SelectedIndex Changed += new
System.EventHan dler(this.GridV iew1_SelectedIn dexChanged()); ----This
line has an error
Panel1.Controls .Add(g);

here is the method i wish to handle the event.
void GridView1_Selec tedIndexChanged (object sender, e)
{
GridViewRow row = o.SelectedRow;
TextBox1.Text = row.Cells[1].Text;
}

Can someone please take a look and please tell me what I am doing
wrong?

Thanks,

KC

Jan 19 '06 #2
Dont I feel stupid...... LOL thanks

KC

Jan 19 '06 #3

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

Similar topics

0
5406
by: PeacError | last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1: I apologize if this question has been addressed elsewhere, but I could not find a reference to it in the search engine for this board. I have a form that contains a ListView and a GroupBox control. The GroupBox control itself contains several TextBox Controls. I have...
6
4159
by: Blaine Manyluk | last post by:
I have a very unusual request. I need to be able to generate reports and save them as TIF files, with full programmatic control. The application will provide the filenames. Each page of the report will be saved as a seperate file. All the user should have to do is press a button to generate the TIFs, without having to "touch the meat" of...
4
1637
by: Jimmy M | last post by:
I've got a page that generates dropdowns and text boxes based on database data. I have them all set to auto-postback because I'll be using this with Atlas to make a more seamless user experience. I've got the Atlas/AJAX turned off for now. I've got a page with a Wizard control. On step three of the wizard is an empty panel. In my...
11
36941
by: J055 | last post by:
Hi I have a dropdown control which is constructed in another dropdown control SelectedIndexChanged event protected void ddlParamType_SelectedIndexChanged(object sender, EventArgs e) { // some other code DropDownList ddlGroups = new DropDownList(); ddlGroups.SelectedIndexChanged += new
4
5246
by: lakepeir | last post by:
Hello, I have combobox with a selectedindexchanged method that seems to be called when starting the application, launching the form with the combobox and making a change in the drop down box of the combobox. Can anyone tell me why the method is called so often? I would only like the method executed when a user makes a change in the drop...
0
934
by: fanoftvb | last post by:
Hi, i want to put a prompt box into my selectindexchanged section but i keep getting error. I currently has this code (without the prompt box) Dim row As GridViewRow = GridView1.SelectedRow Dim str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("database\db1.mdb") Dim conn As New...
0
2095
by: rajendrsedhain | last post by:
I have problem on Gridview column sorting.I want to sort each column when click to the column head.I implemented the 'GridView1_Sorting methond by using viewstate and in this way below. protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { //ViewState = e.SortExpression == (string)ViewState ? ((string)ViewState ==...
2
13191
by: cmrchs | last post by:
Hello, I have a GridView and an objectDataSource <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AllowPaging="True" /> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" TypeName="ProductsLib.Business.ProductsBLO" SelectMethod="SelectProducts"
1
3283
by: dougancil | last post by:
I have a datagrid view on a page that I'm making and I want to be able to open another form when a user "selects" an entry. I've tried looking through the documentation on how to do that but can't seem to find any. Does anyone know of an easy way to accomplish this task? Here's my code so far: Imports System.Data.SqlClient Imports...
0
7842
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7862
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8138
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6514
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5336
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3775
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3794
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1102
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.