473,774 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView Disappears..... ..

8 New Member
Hello,
I am having a button control and gridview control (programmatical ly bind to d/b).When i click on button,fclick() sub is fired.After this the GridView disappears.The buttonclick updates the same table to which gridView is bound.

The subroutine for button click is as below:
-------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1.   Sub fclick(ByVal o As Object, ByVal e As EventArgs)
  2.  
  3.         Dim con, rs, rs1, rs2, rs3, tnm, fnm, fieldtype
  4.         fnm = fnmt.Text
  5.         tnm = tnmd.SelectedItem.Text
  6.         fieldtype = fieldtyped.SelectedItem.Text
  7.         con = Server.CreateObject("ADODB.Connection")
  8.         con.open("provider=sqloledb;Data Source=dp4;Initial Catalog=svit;User ID=sa;Password=dtpt")
  9.         rs = Server.CreateObject("ADODB.Recordset")
  10.         rs.open("alter table " & tnm & " add " & fnm & " " & fieldtype, con)
  11.         rs1 = Server.CreateObject("ADODB.Recordset")
  12.         rs1.cursortype = 2
  13.         rs1.locktype = 3
  14.         rs1.open("select * from fieldinfo ", con)
  15.         rs1.addnew()
  16.         rs1("tnm") = tnm
  17.         rs1("fnm") = fnm
  18.         rs1("fieldtype") = fieldtype
  19.         rs1.update()
  20.  
  21.         fnmt.Text = ""
  22.  
  23.  
  24.  
  25.     End Sub
  26. <asp:Button ID="Button1" runat="server" Text="Insert Fields" OnClick="fclick"/>
  27. <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:svitConnectionString7 %>" SelectCommand="SELECT srno, fnm, fieldtype FROM fieldinfo WHERE (tnm = @tnm)" >
  28.             <SelectParameters>
  29.                 <asp:SessionParameter Name="tnm" SessionField="user1" Type="String" />
  30.             </SelectParameters>
  31.             <DeleteParameters>
  32.                 <asp:ControlParameter ControlID="GridView1" Name="srno" PropertyName="SelectedValue" />
  33.             </DeleteParameters>
  34.         </asp:SqlDataSource>
  35.         &nbsp;
  36.  
  37.         <asp:GridView ID="GridView2" runat="server" OnSelectedIndexChanged="selch" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
  38.             <Columns>
  39.                 <asp:BoundField DataField="srno" HeaderText="srno" InsertVisible="False" ReadOnly="True"
  40.                     SortExpression="srno" />
  41.                 <asp:BoundField DataField="fnm" HeaderText="fnm" SortExpression="fnm" />
  42.                 <asp:BoundField DataField="fieldtype" HeaderText="fieldtype" SortExpression="fieldtype" />
  43.                 <asp:ButtonField CommandName="Select" Text="Delete" />
  44.             </Columns>
  45.         </asp:GridView>
---------------------------------------------

Please help me in this matter as soon as possible.
Mar 19 '07 #1
0 1172

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9356
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes GridView.Visible = True. I press HIDE and the GridView disappears as expected. After it I press SHOW and the GridView doesn't show.
1
1275
by: willip | last post by:
I have a Gridview control with a Databound Hyperlink. e.g.: <asp:HyperLinkField HeaderText="MyTitle" DataNavigateUrlFields="MyID" DataNavigateUrlFormatString="~/ShowMe.aspx?MyID={0}" DataTextField="MyTitle" SortExpression="MyTitle"> With Norton Ad Blocking turned "Off" this works fine. Turn Norton Ad Blocking "On" and the rest of the Gridview displays, but any Hyperlinks have gone!
0
233
by: sck10 | last post by:
Hello, I have a GridView that I built to show the files in a directory. The problem that I am having is that when I click on the second page (2), the GridView disappears. Also, I can't sort by any of the columns. Below is the code that I am using. Any help would be appreciated. Thanks, sck10
2
3875
by: sck10 | last post by:
Hello, I have a GridView that I built to show the files in a directory. The problem that I am having is that when I click on the second page (2), the GridView disappears. Also, I can't sort by any of the columns. Below is the code that I am using. Any help would be appreciated. Thanks, sck10
2
13201
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few fields to be included in the table, which is to be bound to the gridview. The web form looks like so (Don't worry about the stupidity of this web form for now.):
0
1132
by: Don Miller | last post by:
Without a SQLDataSource declaratively linked to a GridView, I programmatically create a dataset and bind it to a GridView with EnableSortingAndPagingCallbacks=True and Paging=True. The GridView displays (in a View of a MultiView) but when I press the page numbers to page through the dataset, the GridView disappears completely (is not rendered) without a postback. When I take action (press a button) to show the GridView again, the GridView...
1
2170
by: Froefel | last post by:
I'm very new to the ADO.NET and WebForms arena, so the problem that I'm having is probably trivial. Using VS2005, I'm just creating a small test project that has a text box allowing you to enter a SQL statement, a button to execute the statement and a GridView control to display the results. The GridView control should AllowPaging and AllowSorting. The data comes from a SQL datasource, which I access through a connection string stored in...
1
2502
by: John Devlon | last post by:
Hi, I've placed a gridview on a page but it disappears when there is no data. How do i keep the gridview visible, even when there is no data ? (headers etc) Thanx John
0
2705
by: edurazee | last post by:
I am able to create BoundFields and Footer-rows dynamically like this in my GridView: protected void Page_Load(object sender, EventArgs e) { CreateGridView(); } private void CreateGridView() {
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9915
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5358
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.