0
Hi,
I have an aspx page in that when i select check all option and when i click on submit its popping an error message length of the query string exceeds th max query string value.so i have done lot of modifications on web.config file none of the changes are comming into effect,so i want to pass hideen field in aspx page 

can anyone tell me how to pass it in aspx and codebehind.


<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="da_do_select.aspx.vb" Inherits="da_do_select" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script src="js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<style type="text/css">
body
{
font-family: Sans-Serif;
font-size: 9pt;
}
</style>

<script type="text/javascript">
$(document).ready(function () {
$('#checkAll').click(function () {
CheckUncheckAllCheckBoxes("#<%=UI_List_chk.ClientID %>", true)
});

$('#uncheckAll').click(function () {
CheckUncheckAllCheckBoxes("#<%=UI_List_chk.ClientID %>", false)
});
});

function CheckUncheckAllCheckBoxes(objID, checkedValue) {
if (objID == null || objID == undefined)
return;

$(objID + " input[type=checkbox]").each(function () {
this.checked = checkedValue;
});
}
</script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PageDesc" Runat="Server">
<div style="font-size:12pt;font-weight:bold;font-family:Sans-Serif;">Select Names for Da Do Report</div>
Check the names that you want to include on the Da Do Report for printing.<br /><br />

<input id="checkAll" type="button" value="Check All" />  <input id="uncheckAll" type="button" value="Uncheck All" />

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td><asp:CheckBoxList RepeatColumns="4" ID="UI_List_chk" runat="server">
</asp:CheckBoxList></td>
</tr>
<tr>
<td align="right">
<asp:Button ID="UI_Submit_btn" runat="server" Text="Submit" /></td>
</tr>
</table>

</asp:Content>


This is my code behind file..

Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Data.Common.DbDataAdapter
Imports System.Text

Partial Class da_do_select
Inherits System.Web.UI.Page
Public CurrentMonth As Integer
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("---------").ToString())

Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
If Not Page.IsPostBack Then
Call GetNames()
End If
End Sub


Public Sub GetNames()
Dim parentID As String = Left(Request.QueryString("attuid").ToString(), 6)
Dim myCommand As SqlCommand = New SqlCommand
Dim MonthString As String
Dim MonthString2 As String
Dim lsReportType As String = Right(Request.QueryString("attuid").ToString(), 2)
MonthString = Left(Request.QueryString("attuid").ToString(), Len(Request.QueryString("attuid").ToString) - 2)
MonthString2 = Right(MonthString, Len(MonthString) - 6)
CurrentMonth = MonthString2

Try

myCommand.Connection = myConnection
myCommand.CommandText = "spPrintDaDo_TEST"
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.AddWithValue("@Attuid", parentID)
myCommand.Parameters.AddWithValue("@MonthNum", CurrentMonth)
myCommand.CommandTimeout = 120
myConnection.Open()
Dim DR As SqlDataReader = myCommand.ExecuteReader()

While (DR.Read())
Dim lItem As New ListItem
lItem.Text = DR("Name").ToString()
lItem.Value = DR("ATTUID").ToString() & CurrentMonth
UI_List_chk.Items.Add(lItem)
End While

myConnection.Close()

Catch ex As Exception

End Try


End Sub

Protected Sub UI_Submit_btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UI_Submit_btn.Click
' Get the ATTUID of each of the selected people and send to the report page
Dim sList As StringBuilder = New StringBuilder
Dim lName As ListItem
For Each lName In UI_List_chk.Items
If lName.Selected = True Then
'Add the ATTUID to the Stringbuilder
sList.Append(lName.Text.ToString() & ";" & lName.Value.ToString() & "|")
End If
Next
Dim finalList As String
finalList = sList.ToString()
'Remove trailing comma
finalList = finalList.Substring(0, finalList.Length - 1)
Response.Redirect("daily_dollar_report_print.aspx?list=" & finalList)

End Sub





<%@ Page Title="" Language="VB" MasterPageFile="~/site.master" AutoEventWireup="false" CodeFile="da_do_select.aspx.vb" Inherits="da_do_select" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<script src="js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<style type="text/css">
body
{
font-family: Sans-Serif;
font-size: 9pt;
}
</style>

<script type="text/javascript">
$(document).ready(function () {
$('#checkAll').click(function () {
CheckUncheckAllCheckBoxes("#<%=UI_List_chk.ClientID %>", true)
});

$('#uncheckAll').click(function () {
CheckUncheckAllCheckBoxes("#<%=UI_List_chk.ClientID %>", false)
});
});

function CheckUncheckAllCheckBoxes(objID, checkedValue) {
if (objID == null || objID == undefined)
return;

$(objID + " input[type=checkbox]").each(function () {
this.checked = checkedValue;
});
}
</script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="PageDesc" Runat="Server">
<div style="font-size:12pt;font-weight:bold;font-family:Sans-Serif;">Select Names for Da Do Report</div>
Check the names that you want to include on the Da Do Report for printing.<br /><br />

<input id="checkAll" type="button" value="Check All" />  <input id="uncheckAll" type="button" value="Uncheck All" />

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td><asp:CheckBoxList RepeatColumns="4" ID="UI_List_chk" runat="server">
</asp:CheckBoxList></td>
</tr>
<tr>
<td align="right">
<asp:Button ID="UI_Submit_btn" runat="server" Text="Submit" /></td>
</tr>
</table>

</asp:Content>


This is my code behind file.



Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.Data.Common.DbDataAdapter
Imports System.Text

Partial Class da_do_select
Inherits System.Web.UI.Page
Public CurrentMonth As Integer
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("---------").ToString())

Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreLoad
If Not Page.IsPostBack Then
Call GetNames()
End If
End Sub


Public Sub GetNames()
Dim parentID As String = Left(Request.QueryString("attuid").ToString(), 6)
Dim myCommand As SqlCommand = New SqlCommand
Dim MonthString As String
Dim MonthString2 As String
Dim lsReportType As String = Right(Request.QueryString("attuid").ToString(), 2)
MonthString = Left(Request.QueryString("attuid").ToString(), Len(Request.QueryString("attuid").ToString) - 2)
MonthString2 = Right(MonthString, Len(MonthString) - 6)
CurrentMonth = MonthString2

Try

myCommand.Connection = myConnection
myCommand.CommandText = "spPrintDaDo_TEST"
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.AddWithValue("@Attuid", parentID)
myCommand.Parameters.AddWithValue("@MonthNum", CurrentMonth)
myCommand.CommandTimeout = 120
myConnection.Open()
Dim DR As SqlDataReader = myCommand.ExecuteReader()

While (DR.Read())
Dim lItem As New ListItem
lItem.Text = DR("Name").ToString()
lItem.Value = DR("ATTUID").ToString() & CurrentMonth
UI_List_chk.Items.Add(lItem)
End While

myConnection.Close()

Catch ex As Exception

End Try


End Sub

Protected Sub UI_Submit_btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles UI_Submit_btn.Click
' Get the ATTUID of each of the selected people and send to the report page
Dim sList As StringBuilder = New StringBuilder
Dim lName As ListItem
For Each lName In UI_List_chk.Items
If lName.Selected = True Then
'Add the ATTUID to the Stringbuilder
sList.Append(lName.Text.ToString() & ";" & lName.Value.ToString() & "|")
End If
Next
Dim finalList As String
finalList = sList.ToString()
'Remove trailing comma
finalList = finalList.Substring(0, finalList.Length - 1)
Response.Redirect("daily_dollar_report_print.aspx?list=" & finalList)

End Sub
End Class
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by aquamarine_kath
0

There are several ways to do this. For example, just create a session variable, then assign the value to the session variable. You can access this session variable throughout the session's life cycle.

Or, if you needed long term storage of information, it could be written to a database table, or even a cookie on the user's computer.

0

example:

first, create a session and assign a value.

Session("example") = txtExample.text

and then if you want to retrieve it from another page, do something like this:

lblExample2.Text = Session("example").ToString()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.