473,383 Members | 1,759 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,383 software developers and data experts.

GridView Disappears.......

8
Hello,
I am having a button control and gridview control (programmatically 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 1152

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

Similar topics

1
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...
1
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}"...
0
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...
2
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...
2
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...
0
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...
1
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...
1
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
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(); ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.