PDA

Click to See Complete Forum and Search --> : request.querystring error


Grunt
Jul 1st, 2005, 02:25 PM
I downloaded a custom control from here:
http://www.codeproject.com/aspnet/dwtabstrip.asp

it was written in c#, but I have the compile dll so it should work fine in vb...


Imports doug.Components
Partial Class Main
Inherits System.Web.UI.Page

Public OurId As String

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
OurId = Request.QueryString("pjID")
Catch ex As Exception
OurId = "0"
End Try

Dim tabFusion As New TabList
Dim tabMain As New Tab
tabMain.DisplayName = "Main"
tabMain.DisplayPosition = 0
tabFusion.AddTab(tabMain)
tabMain.URL = "FusionMain.aspx?pjID=" & OurId

Dim tabAdd As New Tab
tabAdd.DisplayName = "Add"
tabAdd.DisplayPosition = 1
tabFusion.AddTab(tabAdd)
tabMain.URL = "AddTicket.aspx?pjID=" & OurId

Dim tabSearch As New Tab
tabSearch.DisplayName = "Search"
tabSearch.DisplayPosition = 2
tabFusion.AddTab(tabSearch)
tabMain.URL = "Search.aspx?pjID=" & OurId

Dim tabReport As New Tab
tabReport.DisplayName = "Report"
tabReport.DisplayPosition = 3
tabFusion.AddTab(tabReport)

Dim tabLogOut As New Tab
tabLogOut.DisplayName = "LogOut"
tabLogOut.DisplayPosition = 4
tabFusion.AddTab(tabLogOut)

tabFusion.TargetFrame = "pageview"

'add tabfusion to the placeholder to define
'its location
Me.plcTabHolder.Controls.Add(tabFusion)

If Request.QueryString("seltab").Length = 0 Then
tabFusion.SelectedTab = 0
Else
tabFusion.SelectedTab = Convert.ToInt32(Request.QueryString("seltab"))
End If
End Sub


i am getting an object not set to an instance of an object on the if request.querystring line.

here is the code for the control that was used in the articel demo:

public class Tabs : System.Web.UI.Page
{
protected doug.Components.TabList TabList2;
public string ourID;

private void Page_Load(object sender, System.EventArgs e)
{

try
{
ourID = Request.Querystring["pjID"];
}
catch
{
ourID = "0";
}

doug.Components.Tab myTab = new doug.Components.Tab();

#region Tab1
myTab.DisplayName = " Project Home ";

myTab.DisplayPosition = 0;

myTab.URL = "projectHome.aspx?pjID=" + ourID;

TabList2.AddTab(myTab);
#endregion

#region Tab2
doug.Components.Tab myTab2 = new doug.Components.Tab();

myTab2.DisplayName = " Consultants ";

myTab2.DisplayPosition = 1;

myTab2.URL = "prjConsultants.aspx?pjID=" + ourID;

TabList2.AddTab(myTab2);
#endregion

#region Tab3
doug.Components.Tab myTab3 = new doug.Components.Tab();

myTab3.DisplayName = " Contact List ";

myTab3.DisplayPosition = 2;

myTab3.URL = "prjContactsList.aspx?pjID=" + ourID;

TabList2.AddTab(myTab3);
#endregion

#region Tab4
doug.Components.Tab myTab4 = new doug.Components.Tab();

myTab4.DisplayName = " Documents ";

myTab4.DisplayPosition = 3;

myTab4.URL = "projectDocs.aspx?pjID=" + ourID;

TabList2.AddTab(myTab4);
#endregion

#region Tab5
doug.Components.Tab myTab5 = new doug.Components.Tab();

myTab5.DisplayName = " Country B Plan ";

myTab5.DisplayPosition = 4;

myTab5.URL = "uplCountryBPlan.aspx?planType=1&pjID=" + ourID;

TabList2.AddTab(myTab5);
#endregion

#region Tab6
doug.Components.Tab myTab6 = new doug.Components.Tab();

myTab6.DisplayName = " Non Country B Plan ";

myTab6.DisplayPosition = 5;

myTab6.URL = "uplCountryBPlan.aspx?planType=0&pjID=" + ourID;

TabList2.AddTab(myTab6);
#endregion

#region Tab7
doug.Components.Tab myTab7 = new doug.Components.Tab();

myTab7.DisplayName = " Budget ";

myTab7.DisplayPosition = 6;

myTab7.URL = "Budget.aspx?pjID=" + ourID;

TabList2.AddTab(myTab7);
#endregion

#region Tab8
doug.Components.Tab myTab8 = new doug.Components.Tab();

myTab8.DisplayName = " Action Steps ";

myTab8.DisplayPosition = 7;

myTab8.URL = "actionSteps.aspx?pjID=" + ourID;

TabList2.AddTab(myTab8);
#endregion

if (Request.Querystring["seltab"].Length == 0)
{
TabList2.SelectedTab = 0;
}
else
{
TabList2.SelectedTab = Convert.ToInt32(Request.Querystring["seltab"]);
}
}


Can anyone give me some insight as to why I am getting that error?

alex_read
Jul 3rd, 2005, 09:20 AM
At a guess, I'd say the request object is part of the page object, so, when you need to access this from a control on the page, you need to call the parent.page object I think it is to reference this...

mendhak
Jul 4th, 2005, 08:54 AM
I think seltab isn't in the querystring at all.

Grunt
Jul 5th, 2005, 12:06 AM
yeah, I wanted a kind of tabstrip control, but the IE web controls on work for asp 1.1, and I was having trouble getting some custom controls to work. So I figured I'd just create a tabstrip from html and a table, and have the pages load in an iframe..., and with findcontrol, I can set the iframe pages dynamically... So all is good now...