Hi, Could you please help me on the issue of using the ASCII value of Georgian language characters. How can I change the english alphabet? I cannot retrive data since my contact list is in Georgian language. Here is the code:
public partial class alfabet : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["CurrentAlphabet"] = "ALL"; this.GenerateAlphabets(); this.BindDataList(); } }
public class Alphabet { private string _value; private bool _isNotSelected;
public string Value { get { return _value; } set { _value = value; } }
public bool isNotSelected { get { return _isNotSelected; } set { _isNotSelected = value; } } }
private void GenerateAlphabets() { List alphabets = new List(); Alphabet alphabet = new Alphabet(); alphabet.Value = "ALL"; alphabet.isNotSelected = !alphabet.Value .Equals(ViewState["CurrentAlphabet"]); alphabets.Add(alphabet); for (int i = 65; i <= 90; i++) { alphabet = new Alphabet(); alphabet.Value = Char.ConvertFromUtf32(i); alphabet.isNotSelected = !alphabet.Value .Equals(ViewState["CurrentAlphabet"]); alphabets.Add(alphabet); } rptAlphabets.DataSource = alphabets; rptAlphabets.DataBind(); }
if (ViewState["CurrentAlphabet"].ToString().Equals("ALL")) lblView.Text = "all Contacts."; else lblView.Text = "Contacts whose name starts with " + ViewState["CurrentAlphabet"].ToString(); }
We just uncovered an odd bug in this gridview with checkboxes. (original thread: http://forums.asp.net/post/4691898.aspx) The idea is to store the checkboxes that are checked into a dictionary that has (username, boolean) in this case the key is username, the value is boolean. As I step through the checkbox state, I'm wanting to make it so when someone unchecks a username checkbox, it gets stripped from the checkbox dictionary. It doesn't seem to be working. I'm using the viewstate to try to keep track of which checkboxes are checked. I guess this is what I get for trying to use GridView with paging, ugh! Here's the code:
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?
Hi, Could you please help me on the issue of using the ASCII value of Georgian language characters. How can I change the english alphabet? I cannot retrive data since my contact list is in Georgian language. Here is the code:
public partial class alfabet : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["CurrentAlphabet"] = "ALL"; this.GenerateAlphabets(); this.BindDataList(); } }
public class Alphabet { private string _value; private bool _isNotSelected;
public string Value { get { return _value; } set { _value = value; } }
public bool isNotSelected { get { return _isNotSelected; } set { _isNotSelected = value; } } }
private void GenerateAlphabets() { List alphabets = new List(); Alphabet alphabet = new Alphabet(); alphabet.Value = "ALL"; alphabet.isNotSelected = !alphabet.Value .Equals(ViewState["CurrentAlphabet"]); alphabets.Add(alphabet); for (int i = 65; i <= 90; i++) { alphabet = new Alphabet(); alphabet.Value = Char.ConvertFromUtf32(i); alphabet.isNotSelected = !alphabet.Value .Equals(ViewState["CurrentAlphabet"]); alphabets.Add(alphabet); } rptAlphabets.DataSource = alphabets; rptAlphabets.DataBind(); }
if (ViewState["CurrentAlphabet"].ToString().Equals("ALL")) lblView.Text = "all Contacts."; else lblView.Text = "Contacts whose name starts with " + ViewState["CurrentAlphabet"].ToString(); }
We just uncovered an odd bug in this gridview with checkboxes. (original thread: http://forums.asp.net/post/4691898.aspx) The idea is to store the checkboxes that are checked into a dictionary that has (username, boolean) in this case the key is username, the value is boolean. As I step through the checkbox state, I'm wanting to make it so when someone unchecks a username checkbox, it gets stripped from the checkbox dictionary. It doesn't seem to be working. I'm using the viewstate to try to keep track of which checkboxes are checked. I guess this is what I get for trying to use GridView with paging, ugh! Here's the code:
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);