I'm getting an error that says "Unrecognised tag prefix or device filter 'rsweb'.
I'm following along on a tutorial that is helping me display a report in a web form. Can someone please look at this markup and let me know what I'm doing wrong?
Filter by: Category :
and Supplier :
you need to register reportview assembly to be able to use reportviewr control
add this at top of aspx page (after page directive)
Using the code below I am populating a drop down menu but the text does not line up. Is there a way so that when the drop down loads that the City part is all in line? Currently the city part can be more to left or more to the right depending on the length of the column before it? Thanks!
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString + ", " + reader("Provider Business Mailing Address State Name").ToString + " " + reader("Provider Business Mailing Address Postal Code").ToString)
End While
I've created some similar functionality in the past for aligning items within Dropdowns that leverages the empty character (ALT+255) to create spaces within drop-downs that are recognized within
It uses some of the available padding within the String formatting function to allocate exactly how many characters you want to use for a specific field and then has an additional function to replace those spaces with the "invisible character" :
string FormatForDropDown(string s, int length) { //Builds a string StringBuilder sb = new StringBuilder(); //Iterates through and replaces the empty values with the empty character (not a space) for (int i = 0; i < length; i++) { sb.Append((i < s.Length) ? s[i].ToString() : " "); } //Outputs the string return sb.ToString(); }
and as far as actually adding the actual entry, it should be used as such :
//Example of the item you would add to your Drop-down list String.Format("{0,24} | {1,12} | {2,24}", FormatForDropDown(valueA, 24), FormatForDropDown(valueB, 12), FormatForDropDown(valueC, 24));
(Warning : This is old code)
Since you are using Visual Basic, it may look something like this :
Public Function FormatForDropDown(ByVal s As String, ByVal length As Integer) As String Dim sb = New StringBuilder() For i As Integer = 0 To length sb.Append(If(i < s.Length, s(i).ToString(), " ")) Next Return sb.ToString() End Function
and
'String to Add' Dim entry = String.Format("{0,24} | {1,24} | {2,24} | {3,24} | {4, 24}",reader("Provider Last Name (Legal Name)").ToString(),reader("Provider Business Mailing Address City Name").ToString(), reader("Provider First Name").ToString(),reader("Provider Business Mailing Address State Name").ToString(), reader("Provider Business Mailing Address Postal Code").ToString() 'Add the entry' customers.Add(entry)
Alternatively, you could simply replace the strings of spaces that you are using with the invisible character " " as mentioned :
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString() + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString() + ", " + reader("Provider Business Mailing Address State Name").ToString() + " " + reader("Provider Business Mailing Address Postal Code").ToString()) End While
I attempted to replace them in the code above however it may not have worked properly. It's just important to note that all of the spaces that you see above within your strings are not actual spaces but the invisible character (ALT+255).
Thanks, this seems to be close to what i need, proglem is some of the last names have a "-" so it throws off the alignment. Thanks for your help with this. Maybe can it be a set width so its like an excel sheet where its just like a straight line between with a set length?
JOHNSON | AJITA | BEAR | DE | 197013036
JOHNSON-Smith | AJITA | BEAR | DE | 197013036
Hi,
You are right. And please refer the similar thread
Maybe you can do like this GridView1.AllowSorting = false; GridView1.Columns[2].Visible = false; //export process GridView1.Visible = true; GridView1.AllowSorting = true;
Thank for your information. I have try to add in the below code, but the problem still same....any idea??
for (int i = gv.Columns.Count - 1; i >= 0; i--)
{
if (gv.Columns[i].Visible == false)
{
gv.HeaderRow.Cells[i].Visible = false;
gv.FooterRow.Cells[i].Visible = false;
}
gv.Columns[i].Visible = false;
}
Hi lansishao,
I have checked your code and to me, the method PrepareControlForExport(Control control) needs some refinement, actually when u replace different controls like link-buttons, dropdowns etc with LiteralControl controls, there you should check the visibility of the actual control, if actual control is visible then you should replace it with Literal otherwise no need to add it. Hopefully you got my point,
else if (current is CheckBox && current.Visible) { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False")); } // Controls has been replace with Literal and Literal is alwasy Visible :) else if (current.Visible == false) { control.Controls.Remove(current); }
Thanks
Thank for your information. But actually i no so understand what you mean. Can you provide me some sample of code? thank you.
here it is,code id Bold and and under-lined
else if (current is CheckBox && current.Visible) // visibility check { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False")); } // Controls has been replace with Literal and Literal is alwasy Visible :) else if (current.Visible == false) { control.Controls.Remove(current); }
Thank you...but after i try ur method add on the code, after export the data to excel, those hidden column still show....
can you share the ASPX page code, where you are hiding the grid columns, like grid item template and specially the hidden column template.
thanks for you...i have set the label to visible and the problem solved..
because it have many page...may i know any best way to amend the code what i post before?
it is good to know that your problem solved, please mark the thread as answered if it helps you
Secondly, in your code you are checking at control Level that if it is visible or not, your code line
if(control.visible==false)
so you have to apply the visible attribute to every control in every grid in every page, other wise chagne the code to export data, that change of code, may introduce other problems :)
not sure from when, I started get error: Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. I am using Microsoft .NET Framework Version:2.0.40607.42; ASP.NET Version:2.0.40607.42 and sql 2005 beta, the connectionstring in web.config like this: It happens on string connString = ConfigurationSettings.ConnectionStrings["dbbase"].ToString(); SqlConnection conn = new SqlConnection(connString); -- this line It seems a few people had this problem, but I could not find an answer. On microsoft site, there is a fix for asp.net 1.1 and it says this happens when there is ' or " in connection string, but both not in my case. please help/ Thanks!
Any luck with this? I've got the same problem.
Anyone find a solution to this?? I have the same problem. I'm fairly sure my connection string in my config file is correct so it has to be a coding error.
Anyone find a solution to this?? I have the same problem. I'm fairly sure my connection string in my config file is correct so it has to be a coding error.
how do i create a drop list from 1 to 40... without out writing 40 plus lines...
see example below which allows the user to select 1 to 10, but if this needs to be extended to 40 then there will be 40 plus lines!!!
Try this:
for (int i = 0; i <= 40; i++) { dropDownList.Add(new ListItem(i,i); //the first i is for text, second for value }
You could create a collection that would holds the numbers 1 to 40 and then bind them to your DropDownList. In this case you would need to use code-behind to populate your List.
DataSet DS = new DataSet(); DataTable members = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand SelectCommand = new SqlCommand(); SelectCommand.CommandType = CommandType.Text;
SelectCommand.CommandText = "SELECT NAME,GENDER,AGE,STATES,CITY,TELEPHONE,EMAIL,CATEGORY,PROFESSION,EMPLOYER,YEARS,EDUCATION,MOTIVATION,INFORMATION,IMAGE FROM members WHERE STATES = @STATES AND CATEGORY = @CATEGORY "; SelectCommand.Connection = conn;
if (GV.Rows.Count == 0) { errormessage.Text = "there are no members to be found, please try it again later"; } if (GV.Rows.Count > 0) { errormessage.Text = ""; }
Usually, HyperLinkField not clickable because DataNavigateUrlFields has null value, check the data. Why not simply passing id value and get another values in another page based this id?
I'm getting an error that says "Unrecognised tag prefix or device filter 'rsweb'.
I'm following along on a tutorial that is helping me display a report in a web form. Can someone please look at this markup and let me know what I'm doing wrong?
Filter by: Category :
and Supplier :
you need to register reportview assembly to be able to use reportviewr control
add this at top of aspx page (after page directive)
Using the code below I am populating a drop down menu but the text does not line up. Is there a way so that when the drop down loads that the City part is all in line? Currently the city part can be more to left or more to the right depending on the length of the column before it? Thanks!
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString + ", " + reader("Provider Business Mailing Address State Name").ToString + " " + reader("Provider Business Mailing Address Postal Code").ToString)
End While
I've created some similar functionality in the past for aligning items within Dropdowns that leverages the empty character (ALT+255) to create spaces within drop-downs that are recognized within
It uses some of the available padding within the String formatting function to allocate exactly how many characters you want to use for a specific field and then has an additional function to replace those spaces with the "invisible character" :
string FormatForDropDown(string s, int length) { //Builds a string StringBuilder sb = new StringBuilder(); //Iterates through and replaces the empty values with the empty character (not a space) for (int i = 0; i < length; i++) { sb.Append((i < s.Length) ? s[i].ToString() : " "); } //Outputs the string return sb.ToString(); }
and as far as actually adding the actual entry, it should be used as such :
//Example of the item you would add to your Drop-down list String.Format("{0,24} | {1,12} | {2,24}", FormatForDropDown(valueA, 24), FormatForDropDown(valueB, 12), FormatForDropDown(valueC, 24));
(Warning : This is old code)
Since you are using Visual Basic, it may look something like this :
Public Function FormatForDropDown(ByVal s As String, ByVal length As Integer) As String Dim sb = New StringBuilder() For i As Integer = 0 To length sb.Append(If(i < s.Length, s(i).ToString(), " ")) Next Return sb.ToString() End Function
and
'String to Add' Dim entry = String.Format("{0,24} | {1,24} | {2,24} | {3,24} | {4, 24}",reader("Provider Last Name (Legal Name)").ToString(),reader("Provider Business Mailing Address City Name").ToString(), reader("Provider First Name").ToString(),reader("Provider Business Mailing Address State Name").ToString(), reader("Provider Business Mailing Address Postal Code").ToString() 'Add the entry' customers.Add(entry)
Alternatively, you could simply replace the strings of spaces that you are using with the invisible character " " as mentioned :
While reader.Read customers.Add(reader("Provider Last Name (Legal Name)").ToString() + ", " + reader("Provider First Name").ToString + " " + reader("Provider Business Mailing Address City Name").ToString() + ", " + reader("Provider Business Mailing Address State Name").ToString() + " " + reader("Provider Business Mailing Address Postal Code").ToString()) End While
I attempted to replace them in the code above however it may not have worked properly. It's just important to note that all of the spaces that you see above within your strings are not actual spaces but the invisible character (ALT+255).
Thanks, this seems to be close to what i need, proglem is some of the last names have a "-" so it throws off the alignment. Thanks for your help with this. Maybe can it be a set width so its like an excel sheet where its just like a straight line between with a set length?
JOHNSON | AJITA | BEAR | DE | 197013036
JOHNSON-Smith | AJITA | BEAR | DE | 197013036
Hi,
You are right. And please refer the similar thread
Maybe you can do like this GridView1.AllowSorting = false; GridView1.Columns[2].Visible = false; //export process GridView1.Visible = true; GridView1.AllowSorting = true;
Thank for your information. I have try to add in the below code, but the problem still same....any idea??
for (int i = gv.Columns.Count - 1; i >= 0; i--)
{
if (gv.Columns[i].Visible == false)
{
gv.HeaderRow.Cells[i].Visible = false;
gv.FooterRow.Cells[i].Visible = false;
}
gv.Columns[i].Visible = false;
}
Hi lansishao,
I have checked your code and to me, the method PrepareControlForExport(Control control) needs some refinement, actually when u replace different controls like link-buttons, dropdowns etc with LiteralControl controls, there you should check the visibility of the actual control, if actual control is visible then you should replace it with Literal otherwise no need to add it. Hopefully you got my point,
else if (current is CheckBox && current.Visible) { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False")); } // Controls has been replace with Literal and Literal is alwasy Visible :) else if (current.Visible == false) { control.Controls.Remove(current); }
Thanks
Thank for your information. But actually i no so understand what you mean. Can you provide me some sample of code? thank you.
here it is,code id Bold and and under-lined
else if (current is CheckBox && current.Visible) // visibility check { control.Controls.Remove(current); control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? "True" : "False")); } // Controls has been replace with Literal and Literal is alwasy Visible :) else if (current.Visible == false) { control.Controls.Remove(current); }
Thank you...but after i try ur method add on the code, after export the data to excel, those hidden column still show....
can you share the ASPX page code, where you are hiding the grid columns, like grid item template and specially the hidden column template.
thanks for you...i have set the label to visible and the problem solved..
because it have many page...may i know any best way to amend the code what i post before?
it is good to know that your problem solved, please mark the thread as answered if it helps you
Secondly, in your code you are checking at control Level that if it is visible or not, your code line
if(control.visible==false)
so you have to apply the visible attribute to every control in every grid in every page, other wise chagne the code to export data, that change of code, may introduce other problems :)
not sure from when, I started get error: Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0. I am using Microsoft .NET Framework Version:2.0.40607.42; ASP.NET Version:2.0.40607.42 and sql 2005 beta, the connectionstring in web.config like this: It happens on string connString = ConfigurationSettings.ConnectionStrings["dbbase"].ToString(); SqlConnection conn = new SqlConnection(connString); -- this line It seems a few people had this problem, but I could not find an answer. On microsoft site, there is a fix for asp.net 1.1 and it says this happens when there is ' or " in connection string, but both not in my case. please help/ Thanks!
Any luck with this? I've got the same problem.
Anyone find a solution to this?? I have the same problem. I'm fairly sure my connection string in my config file is correct so it has to be a coding error.
Anyone find a solution to this?? I have the same problem. I'm fairly sure my connection string in my config file is correct so it has to be a coding error.
how do i create a drop list from 1 to 40... without out writing 40 plus lines...
see example below which allows the user to select 1 to 10, but if this needs to be extended to 40 then there will be 40 plus lines!!!
Try this:
for (int i = 0; i <= 40; i++) { dropDownList.Add(new ListItem(i,i); //the first i is for text, second for value }
You could create a collection that would holds the numbers 1 to 40 and then bind them to your DropDownList. In this case you would need to use code-behind to populate your List.
DataSet DS = new DataSet(); DataTable members = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(); SqlCommand SelectCommand = new SqlCommand(); SelectCommand.CommandType = CommandType.Text;
SelectCommand.CommandText = "SELECT NAME,GENDER,AGE,STATES,CITY,TELEPHONE,EMAIL,CATEGORY,PROFESSION,EMPLOYER,YEARS,EDUCATION,MOTIVATION,INFORMATION,IMAGE FROM members WHERE STATES = @STATES AND CATEGORY = @CATEGORY "; SelectCommand.Connection = conn;
if (GV.Rows.Count == 0) { errormessage.Text = "there are no members to be found, please try it again later"; } if (GV.Rows.Count > 0) { errormessage.Text = ""; }
Usually, HyperLinkField not clickable because DataNavigateUrlFields has null value, check the data. Why not simply passing id value and get another values in another page based this id?
actually my problem is that I am using data grid (not gridview) in web application. The coloumns of data grid is dynamic and also set the autogeneratecoloumn="true" and also allow sortinng="true" but when I am trying to sort the coloumn then no effect,,,,,,,
why is it so?????
Please help me ,,,,, I want to sort the colomns in the datagrid
Thanxxx in advance
hi, to do gridview sorting you need to set SortExpression in the grid's boundfields and templatefields and you need to write code in GridView_Sorting event. refer below links
if (e.Item.Cells[10].Text.ToUpper().Trim() != " ")
area.Text = e.Item.Cells[10].Text;
if (e.Item.Cells[11].Text.ToUpper().Trim() != " ")
email_id.Text = e.Item.Cells[11].Text;
}
protected void user_role_SelectedIndexChanged(object sender, EventArgs e) // to get the class Id of the dropdown list
{
try
{
conn.Open();
Query = "Select CLASS_ID from CLASS_MASTER where CLASS_CATEGORY ='USER_ROLE' and CLASS_VALUE='" + user_role.SelectedItem.Text.ToString() + "'";
SqlCommand SqlCmd = new SqlCommand(Query,conn);
SqlDataReader SqlRead = SqlCmd.ExecuteReader();
while (SqlRead.Read())
{
iUserRole = SqlRead.GetInt32(0);
}
SqlRead.Close();
SqlCmd.Dispose();
}
catch (Exception ex)
{
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
protected void manager_desig_SelectedIndexChanged(object sender, EventArgs e) // to get the class Id of the dropdown list
{
try
{
conn.Open();
Query = "Select CLASS_ID from CLASS_MASTER where CLASS_CATEGORY ='MANAGER_DESIGNATION' and CLASS_VALUE='" + manager_desig.SelectedItem.Text.ToString() + "'";
SqlCommand SqlCmd = new SqlCommand(Query, conn);
SqlDataReader SqlRead = SqlCmd.ExecuteReader();
while (SqlRead.Read())
{
iMgrDesig = SqlRead.GetInt32(0);
}
SqlRead.Close();
SqlCmd.Dispose();
}
catch (Exception ex)
{
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
protected void Button1_Click(object sender, EventArgs e) // to save the user details
{
int RecFound = 0;
if (iUserRole == 0 || iMgrDesig == 0)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('User Role or Manager Designation not selected');", true);