
srithil
Members-
Posts
22 -
Joined
-
Last visited
srithil's Achievements
Newbie (1/14)
0
Reputation
-
Hai, I am trying to transfer some values from page1 to page2.In page1 i am sending the values through a button click event and receiving the values in page2 on my pageload event.I get the error object reference not set to an instance of an object.anybody pls help. thanks. page1.aspx 'on button clicked it has to go to page2.aspx If (p_daily.Checked) Then Context.Items.Add("site", p_siteid.SelectedItem.Value()) Context.Items.Add("daily", p_daily1.Text()) Server.Transfer("page2.aspx") End If If (p_from.Checked) Then Context.Items.Add("site", p_siteid.SelectedItem.Value()) Context.Items.Add("from", p_from1.Text()) Context.Items.Add("to", p_to.Text()) Server.Transfer("page2.aspx") End If In page2.aspx i am receiving the values in my pageload event. but i am getting the error Object reference not set to an instance of an object. Page2.aspx. If Not Page.IsPostBack Then Dim s, s1, s2, s3, s4, s5, strscript As String s = "" s1 = "" s2 = "" s3 = "" s4 = "" s = context.Items("daily") s1 = context.Items("site") s2 = context.Items("from") s3 = context.Items("to") If s.Length <> 0 Then Dim myConnection As New SqlClient.SqlConnection myConnection.ConnectionString = tq() 'database connections and query goes here............. End If If s2.Length <> 0 And s3.Length <> 0 Then Dim myConnection As New SqlClient.SqlConnection myConnection.ConnectionString = tq() 'database connections goes here.................... End If end if
-
I have a webform where i use tabstrips and multipage.I click a button reset and call onclick event doreset to clear all the fields after adding a record.My function doreset works out well in an ordinary webcontrols form.but it is not checking my controls inside the multipage. Is this line correct for a multipage. If objwctype.FullName = "System.Web.UI.ControlCollection.TextBox" I am stuck with this.anybody pls help. tx. Here goes my code <aspnet:tabstrip id="mytabstrip" Targetid="mpVert" runat="server" Width="700px" Height="22px" Font-Size="8pt" AutoPostBack="True" TabSelectedStyle="background-color:#c0c0c0;color:#000000;border-bottom:none;" TabHoverStyle="background-color:#E0E0E0;color:#000000;" TabDefaultStyle="background-color:#666699;"> <aspnet:Tab runat="server" Text="Information"></aspnet:Tab> <aspnet:Tab runat="server" Text="Details"></aspnet:Tab> </aspnet:tabstrip> <aspnet:MultiPage id="mpVert" runat="server"> <aspnet:PageView id="PageView1" runat="server"> I use my webcontrols like textboxes,checkboxes for information tags here........ </aspnetageview> <aspnet:PageView id="PageView2" runat="server"> I use the webcontrols for details tab here </aspnetageview> </aspnet:multipage> sub doReset(sender as object,e as eventargs) Dim objc As Control Response.Write(Page.Controls.Count) For Each objc In Page.Controls Dim objType As Type = objc.GetType If objType.FullName = "System.Web.UI.HtmlControls.HtmlForm" Then Dim objf As HtmlForm = objc Dim objwc As Control For Each objwc In objf.Controls Dim objwctype As Type = objwc.GetType If objwctype.FullName = "System.Web.UI.ControlCollection.TextBox" Then Dim objtb As TextBox = objwc objtb.Text = "" End If Next End If Next end sub
-
Hai, tx for the code it is working.
-
hai , my problem is solved using the following code with selectedindex. thanks. dr_staff.SelectedIndex=pp_staff.Items.IndexOf(dr_staff.Items.FindByValue(mydr1("dr_staff")))
-
I have a webform where i use tabstrips and multipage.I click a button reset and call onclick event doreset to clear all the fields after adding a record.My function doreset works out well in an ordinary webcontrols form.but it is not checking my controls inside the multipage. Is this line correct for a multipage. If objwctype.FullName = "System.Web.UI.ControlCollection.TextBox" I am stuck with this.anybody pls help. tx. Here goes my code <aspnet:tabstrip id="mytabstrip" Targetid="mpVert" runat="server" Width="700px" Height="22px" Font-Size="8pt" AutoPostBack="True" TabSelectedStyle="background-color:#c0c0c0;color:#000000;border-bottom:none;" TabHoverStyle="background-color:#E0E0E0;color:#000000;" TabDefaultStyle="background-color:#666699;"> <aspnet:Tab runat="server" Text="Information"></aspnet:Tab> <aspnet:Tab runat="server" Text="Details"></aspnet:Tab> </aspnet:tabstrip> <aspnet:MultiPage id="mpVert" runat="server"> <aspnet:PageView id="PageView1" runat="server"> I use my webcontrols like textboxes,checkboxes for information tags here........ </aspnet:pageview> <aspnet:PageView id="PageView2" runat="server"> I use the webcontrols for details tab here </aspnet:pageview> </aspnet:multipage> sub doReset(sender as object,e as eventargs) Dim objc As Control Response.Write(Page.Controls.Count) For Each objc In Page.Controls Dim objType As Type = objc.GetType If objType.FullName = "System.Web.UI.HtmlControls.HtmlForm" Then Dim objf As HtmlForm = objc Dim objwc As Control For Each objwc In objf.Controls Dim objwctype As Type = objwc.GetType If objwctype.FullName = "System.Web.UI.ControlCollection.TextBox" Then Dim objtb As TextBox = objwc objtb.Text = "" End If Next End If Next end sub
-
I am populating the dropdownlist from my table Nt_st_staff in my pageload event The design of the table is st_Staff_id St_Staff_name 15 Select 16 Joe,G 17 Martin,L 18 adsfasdf thanks
-
No.this is the viewsource of my page when it loads.but i click a button and try to select the option 16 or 17 say for eg. in my click event.then it selects only the first select option. <select name="dr_staff" onchange="__doPostBack('pc_staff','')" language="javascript" id="dr_staff"> <option selected="selected" value="15">Select</option> <option value="16">Joe,G</option> <option value="17">Martin,L</option> <option value="18">adsfasdf</option> </select> This is the viewsource after my click event.I don't know why it sets the value of the select option to 17 instead of selecting the 17th option <select name=dr_staff" onchange="__doPostBack('pc_staff','')" language="javascript" id="dr_staff"> <option selected="selected" value="17">Select</option> <option value="16">Joe,G</option> <option value="17">Martin,L</option> <option value="18">adsfasdf</option> </select>
-
yes.i am loading the dropdownlist only by checking ispostback method.here ismy code in the pageload event. If Not Page.IsPostBack Then sql3 = "select * from Nt_St_staff" mycon3 = New SqlConnection(tq()) mycon3.Open() mycmd3 = New SqlCommand(sql3, mycon3) mycmd3.CommandType = CommandType.Text mydr3 = mycmd3.ExecuteReader() dr_staff.DataSource = mydr3 dr_staff.DataBind() mycon3.Close() End If thanks
-
This is the viewsource of my page after executing the command. The value is 16.but it is not selecting the option joe. tx <select name="pc_staff" onchange="__doPostBack('dr_staff','')" language="javascript" id="dr_staff"> <option selected="selected" value="16">Select</option> <option value="16">Joe,G</option> <option value="17">Martin,L</option> <option value="18">adsfasdf</option> </select>
-
yes.this is my dropdownlist <asp:dropDownList AutoPostBack=True runat="server" DataTextField="st_staff_name" DataValueField="St_staff_id" id="dr_staff"></asp:dropDownList> tx.
-
yes.this is my dropdownlist <asp:DropDownList AutoPostBack=True runat="server" DataTextField="st_staff_name" DataValueField="St_staff_id" id="dr_staff"></asp:DropDownList> tx.
-
I have a dropdownlist staff. I try to select the option by its value property. I get the value from the datareader correctly,but when i use the following code dr_staff.SelectedItem.value=mydr("st_staff") only the first option is selected.The correct option is not selected. anybody pls help. tx
-
thank you.it works out.
-
hai tx, i am new to asp.net.If possible can u please post me the codes to store in a session variable using dataset.
-
Hai, i am clicking a button 'findnext' and calling the event btnclick on its onclick event.I want to display the records in my form fields one by one. The following code displays only the first record of the datareader in my fields. I want to display my next record when i click the button findnext. How do i display my second record of the datareader?? anybody pls help. tx sub btnclick(sender as object,e as eventargs) Dim mydr1 As SqlDataReader sql1 = "SELECT * FROM Nt_site_contact WHERE " & _ "first_name = '" & s & "'" 'connections goes here mydr1 = mycmd1.ExecuteReader() mydr1.read() While mydr1.Read() pp_last.text =mydr1("last_name") pp_address1.text=mydr1("Address1") End While mydr1.Close() mycon1.Close() end sub.